]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
of: Fix refcount leakage for OF node returned by __of_get_dma_parent()
authorZijun Hu <quic_zijuhu@quicinc.com>
Fri, 6 Dec 2024 00:52:30 +0000 (08:52 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 27 Dec 2024 12:53:01 +0000 (13:53 +0100)
commit28ca6f1d191365c568eace3d433e6288cd7cf57d
treec59ffec8102794fbac71f64ca351028989d46d29
parent76db8a75f04750167ee52ffc171b877c7d629d75
of: Fix refcount leakage for OF node returned by __of_get_dma_parent()

commit 5d009e024056ded20c5bb1583146b833b23bbd5a upstream.

__of_get_dma_parent() returns OF device node @args.np, but the node's
refcount is increased twice, by both of_parse_phandle_with_args() and
of_node_get(), so causes refcount leakage for the node.

Fix by directly returning the node got by of_parse_phandle_with_args().

Fixes: f83a6e5dea6c ("of: address: Add support for the parent DMA bus")
Cc: stable@vger.kernel.org
Signed-off-by: Zijun Hu <quic_zijuhu@quicinc.com>
Link: https://lore.kernel.org/r/20241206-of_core_fix-v1-4-dc28ed56bec3@quicinc.com
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/of/address.c