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: f83a6e5dea ("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>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
24937f999b
commit
f15dec32fb
@@ -692,7 +692,7 @@ static struct device_node *__of_get_dma_parent(const struct device_node *np)
|
||||
if (ret < 0)
|
||||
return of_get_parent(np);
|
||||
|
||||
return of_node_get(args.np);
|
||||
return args.np;
|
||||
}
|
||||
|
||||
u64 of_translate_dma_address(struct device_node *dev, const __be32 *in_addr)
|
||||
|
||||
Reference in New Issue
Block a user