[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20241206-of_core_fix-v1-4-dc28ed56bec3@quicinc.com>
Date: Fri, 06 Dec 2024 08:52:30 +0800
From: Zijun Hu <zijun_hu@...oud.com>
To: Rob Herring <robh@...nel.org>, Saravana Kannan <saravanak@...gle.com>,
Leif Lindholm <leif.lindholm@...aro.org>,
Stephen Boyd <stephen.boyd@...aro.org>, Maxime Ripard <mripard@...nel.org>,
Robin Murphy <robin.murphy@....com>,
Grant Likely <grant.likely@...retlab.ca>
Cc: Zijun Hu <zijun_hu@...oud.com>, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, Zijun Hu <quic_zijuhu@...cinc.com>,
stable@...r.kernel.org
Subject: [PATCH 04/10] of: Fix refcount leakage for OF node returned by
__of_get_dma_parent()
From: Zijun Hu <quic_zijuhu@...cinc.com>
__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@...r.kernel.org
Signed-off-by: Zijun Hu <quic_zijuhu@...cinc.com>
---
drivers/of/address.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/of/address.c b/drivers/of/address.c
index c5b925ac469f16b8ae4b8275b60210a2d583ff83..cda1cbb82eabdcd39d32446023fbb105b69bc99d 100644
--- a/drivers/of/address.c
+++ b/drivers/of/address.c
@@ -619,7 +619,7 @@ 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;
}
#endif
--
2.34.1
Powered by blists - more mailing lists