]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
staging: media: imx: fix OF node leak in imx_media_add_of_subdevs()
authorJoe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Tue, 24 Dec 2024 03:54:11 +0000 (12:54 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 11:50:09 +0000 (12:50 +0100)
commit68ee578e6e31e88fd02681ca1e45ddf86784367c
treec69d6e6c753d0595cbbd30a05f79697cb8eed7e6
parent6f3c167de05763dee0eb225ab47cf112a44cce8d
staging: media: imx: fix OF node leak in imx_media_add_of_subdevs()

[ Upstream commit 094f5c315f756b19198e6c401aa821ac0e868750 ]

imx_media_add_of_subdevs() calls of_parse_phandle() and passes the
obtained node to imx_media_of_add_csi(). The passed node is used in
v4l2_async_nf_add_fwnode(), which increments the refcount of the node.
Therefore, while the current implementation only releases the node when
imx_media_of_add_csi() fails, but should always release it. Call
of_node_put() right after imx_media_of_add_csi().

Fixes: dee747f88167 ("media: imx: Don't register IPU subdevs/links if CSI port missing")
Signed-off-by: Joe Hattori <joe@pf.is.s.u-tokyo.ac.jp>
Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/staging/media/imx/imx-media-of.c