From: Brian King <brking@linux.vnet.ibm.com>
To: linuxppc-dev@lists.ozlabs.org
Cc: Brian King <brking@linux.vnet.ibm.com>,
mmc@linux.vnet.ibm.com, brking@pobox.com
Subject: [PATCH 7/7] powerpc: Fix device node refcounting
Date: Mon, 30 Jan 2023 16:43:21 -0600 [thread overview]
Message-ID: <20230130224321.164843-8-brking@linux.vnet.ibm.com> (raw)
In-Reply-To: <20230130224321.164843-1-brking@linux.vnet.ibm.com>
While testing fixes to the hvcs hotplug code, kmemleak was reporting
potential memory leaks. This was tracked down to the struct device_node
object associated with the hvcs device. Looking at the leaked
object in crash showed that the kref in the kobject in the device_node
had a reference count of 1 still, and the release function was never
getting called as a result of this. This adds an of_node_put in
pSeries_reconfig_remove_node in order to balance the refcounting
so that we actually free the device_node in the case of it being
allocated in pSeries_reconfig_add_node.
Signed-off-by: Brian King <brking@linux.vnet.ibm.com>
---
arch/powerpc/platforms/pseries/reconfig.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/powerpc/platforms/pseries/reconfig.c b/arch/powerpc/platforms/pseries/reconfig.c
index 599bd2c78514..8cb7309b19a4 100644
--- a/arch/powerpc/platforms/pseries/reconfig.c
+++ b/arch/powerpc/platforms/pseries/reconfig.c
@@ -77,6 +77,7 @@ static int pSeries_reconfig_remove_node(struct device_node *np)
}
of_detach_node(np);
+ of_node_put(np);
of_node_put(parent);
return 0;
}
--
2.31.1
next prev parent reply other threads:[~2023-01-30 22:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-30 22:43 [PATCH 0/7] hvcs: Various hvcs device hotplug fixes Brian King
2023-01-30 22:43 ` [PATCH 1/7] hvcs: Fix hvcs port reference counting Brian King
2023-01-30 22:43 ` [PATCH 2/7] hvcs: Remove sysfs file prior to vio unregister Brian King
2023-01-30 22:43 ` [PATCH 3/7] hvcs: Remove sysfs group earlier Brian King
2023-01-30 22:43 ` [PATCH 4/7] hvcs: Get reference to tty in remove Brian King
2023-01-30 22:43 ` [PATCH 5/7] hvcs: Use vhangup in hotplug remove Brian King
2023-01-30 22:43 ` [PATCH 6/7] hvcs: Synchronize hotplug remove with port free Brian King
2023-01-30 22:43 ` Brian King [this message]
2023-02-01 10:32 ` [PATCH 0/7] hvcs: Various hvcs device hotplug fixes Christophe Leroy
2023-02-01 15:09 ` Brian King
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=20230130224321.164843-8-brking@linux.vnet.ibm.com \
--to=brking@linux.vnet.ibm.com \
--cc=brking@pobox.com \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=mmc@linux.vnet.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;
as well as URLs for NNTP newsgroup(s).