mirror of
https://github.com/torvalds/linux.git
synced 2026-09-25 17:42:03 +02:00
ARM: imx: fix device_node refcount leak in imx_src_init()
imx_src_init() obtains a device_node reference via
of_find_compatible_node() matching "fsl,imx51-src" and uses it only to
call of_iomap(). It never releases that reference: on the success path
the function returns at the end without of_node_put(np), leaking one
device_node refcount on every boot of an i.MX5/6 platform.
Release the reference right after of_iomap(). of_iomap() maps the
node's registers but does not retain a reference to the device_node, so
the node can be put once the mapping is done. The early return on a NULL
np needs no put.
Found by static analysis tool CodeQL.
Fixes: bd3d924d71 ("ARM i.MX5: Add System Reset Controller (SRC) support for i.MX51 and i.MX53")
Signed-off-by: Weigang He <geoffreyhe2@gmail.com>
Signed-off-by: Frank Li <Frank.Li@nxp.com>
This commit is contained in:
parent
b24c12e1ba
commit
936407c356
|
|
@ -171,6 +171,7 @@ void __init imx_src_init(void)
|
|||
if (!np)
|
||||
return;
|
||||
src_base = of_iomap(np, 0);
|
||||
of_node_put(np);
|
||||
WARN_ON(!src_base);
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user