Skip to content

Commit 5d009e0

Browse files
zijun-hurobherring
authored andcommitted
of: Fix refcount leakage for OF node returned by __of_get_dma_parent()
__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: f83a6e5 ("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>
1 parent d7dfa7f commit 5d009e0

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/of/address.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -620,7 +620,7 @@ struct device_node *__of_get_dma_parent(const struct device_node *np)
620620
if (ret < 0)
621621
return of_get_parent(np);
622622

623-
return of_node_get(args.np);
623+
return args.np;
624624
}
625625
#endif
626626

0 commit comments

Comments
 (0)