diff options
| author | Weigang He <geoffreyhe2@gmail.com> | 2026-06-10 15:06:25 +1000 |
|---|---|---|
| committer | Frank Li <Frank.Li@nxp.com> | 2026-06-29 15:57:18 -0400 |
| commit | 3de939b2ac843d56d88e2ab1e1b1f667cba9e1d4 (patch) | |
| tree | fe1f6a0dddc019c7e26bc4dabe1668025d200acb /tools/perf/scripts/python/bin/stackcollapse-record | |
| parent | 936407c3563ac745cbbb9953c0cf2472128a22f4 (diff) | |
ARM: imx: fix device_node refcount leaks in imx7_src_init()
imx7_src_init() obtains two device_node references via
of_find_compatible_node() - one for "fsl,imx7d-src" and one for
"fsl,imx7d-gpc" - reusing the same np variable, but never calls
of_node_put() on either. On every i.MX7D boot up to two device_node
refcounts are leaked:
- The "fsl,imx7d-src" node is leaked both when of_iomap() fails (the
early return after the mapping) and when it succeeds, because np is
then overwritten by the second of_find_compatible_node() call
without releasing the prior reference.
- The "fsl,imx7d-gpc" node is leaked on every path leaving the
function after it is acquired.
Release each reference immediately after of_iomap() consumes the node.
of_iomap() maps the node's registers but does not retain a reference to
the device_node, so it is safe to put the node once mapped; this also
drops the first reference before np is reused for the second lookup.
Found by static analysis tool CodeQL.
Fixes: e34645f45805 ("ARM: imx: add smp support for imx7d")
Signed-off-by: Weigang He <geoffreyhe2@gmail.com>
Signed-off-by: Frank Li <Frank.Li@nxp.com>
Diffstat (limited to 'tools/perf/scripts/python/bin/stackcollapse-record')
0 files changed, 0 insertions, 0 deletions
