From: Liang He <windhl@126.com>
To: mpe@ellerman.id.au, paulus@samba.org,
christophe.leroy@csgroup.eu, nick.child@ibm.com, pali@kernel.org,
npiggin@gmail.com
Cc: linuxppc-dev@lists.ozlabs.org, windhl@126.com,
linux-kernel@vger.kernel.org
Subject: [PATCH] powerpc: sysdev: Fix refcount leak bug in fsl_pci.c
Date: Sat, 18 Jun 2022 11:32:07 +0800 [thread overview]
Message-ID: <20220618033207.4057410-1-windhl@126.com> (raw)
In is_kdump(), we need a of_node_put() to dec the refcount which is
incremented by of_find_node_by_type().
Signed-off-by: Liang He <windhl@126.com>
---
arch/powerpc/sysdev/fsl_pci.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/powerpc/sysdev/fsl_pci.c b/arch/powerpc/sysdev/fsl_pci.c
index 1011cfea2e32..4c986c955951 100644
--- a/arch/powerpc/sysdev/fsl_pci.c
+++ b/arch/powerpc/sysdev/fsl_pci.c
@@ -180,6 +180,7 @@ static int setup_one_atmu(struct ccsr_pci __iomem *pci,
static bool is_kdump(void)
{
struct device_node *node;
+ bool ret;
node = of_find_node_by_type(NULL, "memory");
if (!node) {
@@ -187,7 +188,10 @@ static bool is_kdump(void)
return false;
}
- return of_property_read_bool(node, "linux,usable-memory");
+ ret = of_property_read_bool(node, "linux,usable-memory");
+ of_node_put(node);
+
+ return ret;
}
/* atmu setup for fsl pci/pcie controller */
--
2.25.1
reply other threads:[~2022-06-18 3:33 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20220618033207.4057410-1-windhl@126.com \
--to=windhl@126.com \
--cc=christophe.leroy@csgroup.eu \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mpe@ellerman.id.au \
--cc=nick.child@ibm.com \
--cc=npiggin@gmail.com \
--cc=pali@kernel.org \
--cc=paulus@samba.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).