LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Haotian Zhang <vulab@iscas.ac.cn>
To: Madhavan Srinivasan <maddy@linux.ibm.com>,
	Michael Ellerman <mpe@ellerman.id.au>,
	Nicholas Piggin <npiggin@gmail.com>,
	Shrikanth Hegde <sshegde@linux.ibm.com>,
	Hari Bathini <hbathini@linux.vnet.ibm.com>
Cc: linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org
Subject: [PATCH] powerpc/opalcore: fix device node leak on incompatible dump node
Date: Fri,  9 Oct 2026 03:05:49 +0800	[thread overview]
Message-ID: <20261008190549.2800467-1-vulab@iscas.ac.cn> (raw)

opalcore_config_init() gets a reference on the "/ibm,opal/dump" device
node with of_find_node_by_path(), but when the node is not compatible
with "ibm,opal-dump" it warns and returns without dropping that
reference, leaking the node. Every other exit path, including the
adjacent of_get_property() failure, releases it.

Release the device node reference before returning from that error path.

Fixes: 6f713d18144c ("powerpc/opalcore: export /sys/firmware/opal/core for analysing opal crashes")
Assisted-by: DeepSeek-V4.1-Flash
Signed-off-by: Haotian Zhang <vulab@iscas.ac.cn>
---
 arch/powerpc/platforms/powernv/opal-core.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/powerpc/platforms/powernv/opal-core.c b/arch/powerpc/platforms/powernv/opal-core.c
index 32662d30d70f..fbf4677e811d 100644
--- a/arch/powerpc/platforms/powernv/opal-core.c
+++ b/arch/powerpc/platforms/powernv/opal-core.c
@@ -455,6 +455,7 @@ static void __init opalcore_config_init(void)
 
 	if (!of_device_is_compatible(np, "ibm,opal-dump")) {
 		pr_warn("Support missing for this f/w version!\n");
+		of_node_put(np);
 		return;
 	}
 
-- 
2.25.1



             reply	other threads:[~2026-10-08 19:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-08 19:05 Haotian Zhang [this message]
2026-10-09  6:10 ` [PATCH] powerpc/opalcore: fix device node leak on incompatible dump node 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=20261008190549.2800467-1-vulab@iscas.ac.cn \
    --to=vulab@iscas.ac.cn \
    --cc=hbathini@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=maddy@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=npiggin@gmail.com \
    --cc=sshegde@linux.ibm.com \
    /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