From: Wentao Liang <vulab@iscas.ac.cn>
To: devicetree@vger.kernel.org
Cc: frowand.list@gmail.com, linux-kernel@vger.kernel.org,
robh@kernel.org, saravanak@kernel.org,
Wentao Liang <vulab@iscas.ac.cn>,
stable@vger.kernel.org
Subject: [PATCH] of: unittest: Fix of_symbols reference leak in of_unittest_overlay_high_level()
Date: Thu, 17 Sep 2026 12:57:17 +0000 [thread overview]
Message-ID: <20260917125717.2152371-1-vulab@iscas.ac.cn> (raw)
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
next reply other threads:[~2026-09-17 12:57 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-17 12:57 Wentao Liang [this message]
2026-09-18 11:41 ` [PATCH] of: unittest: Fix of_symbols reference leak in of_unittest_overlay_high_level() Krzysztof Kozlowski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260917125717.2152371-1-vulab@iscas.ac.cn \
--to=vulab@iscas.ac.cn \
--cc=devicetree@vger.kernel.org \
--cc=frowand.list@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=saravanak@kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).