Skip to content

ARM: imx: fix device_node refcount leaks in src.c

Weigang He imx linux-arm-kernel lkml 1 version Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest2 patches 1 replyApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/2ARM: imx: fix device_node refcount leak in imx_src_init()arch/arm/mach-imx/src.c+1 -00 replies
2/2ARM: imx: fix device_node refcount leaks in imx7_src_init()arch/arm/mach-imx/src.c+2 -00 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH 0/2] ARM: imx: fix device_node refcount leaks in src.c

arch/arm/mach-imx/src.c leaks the device_node references taken by of_find_compatible_node() in two __init functions: imx_src_init() leaks the "fsl,imx51-src" node, and imx7_src_init() leaks the "fsl,imx7d-src" and "fsl,imx7d-gpc" nodes (the first one twice, because np is reused for the second lookup without a put). of_iomap() does not take ownership of the node, so these are one-shot device_node refcount leaks per boot.

The two functions were introduced by different commits, so they are split into one patch each. Each drops the reference right after of_iomap() consumes the node.

Found by static analysis tool CodeQL. The series is build-tested only (arm, imx_v6_v7_defconfig); I have no i.MX hardware, so runtime testing would be appreciated.

Weigang He (2):
ARM: imx: fix device_node refcount leak in imx_src_init()
ARM: imx: fix device_node refcount leaks in imx7_src_init()

 arch/arm/mach-imx/src.c | 3 +++
 1 file changed, 3 insertions(+)

base-commit: 0f61b1860cc3f52aef9036d7235ed1f017632193

Signature · 1 line
2.43.0