[PATCH] of: unittest: Fix of_symbols reference leak in of_unittest_overlay_high_level()

Wentao Liang posted 1 patch 1 week ago
drivers/of/unittest.c | 4 ++++
1 file changed, 4 insertions(+)
[PATCH] of: unittest: Fix of_symbols reference leak in of_unittest_overlay_high_level()
Posted by Wentao Liang 1 week ago
of_get_child_by_name() returns a node with an elevated reference count,
but the function never drops it: neither on the early return for an
illegal node name, nor on the normal return, nor on the err_unlock
path. Add the missing of_node_put() calls.

Fixes: 81d0848fc8d2 ("of: Add unit tests for applying overlays")
Cc: stable@vger.kernel.org
Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>
---
 drivers/of/unittest.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c
index 900840850814..36c64d485a53 100644
--- a/drivers/of/unittest.c
+++ b/drivers/of/unittest.c
@@ -4091,6 +4091,7 @@ static __init void of_unittest_overlay_high_level(void)
 					 np);
 				of_node_put(np);
 				of_node_put(base_child);
+				of_node_put(of_symbols);
 				return;
 			}
 		}
@@ -4289,10 +4290,13 @@ static __init void of_unittest_overlay_high_level(void)
 	EXPECT_END(KERN_ERR,
 		   "OF: resolver: node label 'this_label_does_not_exist' not found in live devicetree symbols table");
 
+	of_node_put(of_symbols);
+
 	return;
 
 err_unlock:
 	mutex_unlock(&of_mutex);
+	of_node_put(of_symbols);
 }
 
 static int of_unittest_pci_dev_num;
-- 
2.34.1
Re: [PATCH] of: unittest: Fix of_symbols reference leak in of_unittest_overlay_high_level()
Posted by Krzysztof Kozlowski 6 days, 14 hours ago
On Thu, Sep 17, 2026 at 12:57:17PM +0000, Wentao Liang wrote:
> of_get_child_by_name() returns a node with an elevated reference count,
> but the function never drops it: neither on the early return for an
> illegal node name, nor on the normal return, nor on the err_unlock
> path. Add the missing of_node_put() calls.
> 
> Fixes: 81d0848fc8d2 ("of: Add unit tests for applying overlays")
> Cc: stable@vger.kernel.org
> Signed-off-by: Wentao Liang <vulab@iscas.ac.cn>

Why are you sending 10 separate patches, one by one, not a proper
patchset? It's the same as with Guangshuo Li.

Look:
https://lore.kernel.org/all/?q=f%3AWentao+Liang+%3Cvulab%40iscas.ac.cn%3E

Absolutely nothing is threaded. No way for a subsystem maintainer to for
example drop one comment for entire subsystem. Instead you ask
maintainer to reply TO EACH of the patches.

Best regards,
Krzysztof