mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Miaoqian Lin <linmq006@gmail.com>
To: "David S. Miller" <davem@davemloft.net>,
	Miaoqian Lin <linmq006@gmail.com>,
	Daniel Hellstrom <daniel@gaisler.com>,
	sparclinux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH] sparc32,leon: Fix reference leak in leon_ipi_init
Date: Sun,  5 Jun 2022 09:29:41 +0400	[thread overview]
Message-ID: <20220605052943.54265-1-linmq006@gmail.com> (raw)

of_find_node_by_path() returns a node pointer with
refcount incremented, we should use of_node_put() on it when done.
Add missing of_node_put() to avoid refcount leak.

Fixes: 1ca0c808c60f ("sparc32,leon: Implemented SMP IPIs for LEON CPU")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
 arch/sparc/kernel/leon_smp.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/sparc/kernel/leon_smp.c b/arch/sparc/kernel/leon_smp.c
index 1eed26d423fb..85b22669c002 100644
--- a/arch/sparc/kernel/leon_smp.c
+++ b/arch/sparc/kernel/leon_smp.c
@@ -284,6 +284,7 @@ static void __init leon_ipi_init(void)
 		pp = of_find_property(rootnp, "ipi_num", &len);
 		if (pp && (*(int *)pp->value))
 			leon_ipi_irq = *(int *)pp->value;
+		of_node_put(rootnp);
 	}
 	printk(KERN_INFO "leon: SMP IPIs at IRQ %d\n", leon_ipi_irq);
 
-- 
2.25.1


             reply	other threads:[~2022-06-05  5:29 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-05  5:29 Miaoqian Lin [this message]
2022-06-05  7:48 ` Sam Ravnborg
2022-06-05  9:02   ` Miaoqian Lin

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=20220605052943.54265-1-linmq006@gmail.com \
    --to=linmq006@gmail.com \
    --cc=daniel@gaisler.com \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sparclinux@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

all inboxes | Powered by JetHome®