linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
To: mpe@ellerman.id.au
Cc: linuxppc-dev@lists.ozlabs.org, robh+dt@kernel.org,
	abdhalee@linux.vnet.ibm.com, paulus@samba.org,
	sachinp@linux.vnet.ibm.com, linux-kernel@vger.kernel.org,
	Tyrel Datwyler <tyreld@linux.vnet.ibm.com>,
	stable@vger.kernel.org, #@b01ledav001.gho.pok.ibm.com,
	v3.12+@b01ledav001.gho.pok.ibm.com
Subject: [PATCH 2/2] powerpc/pseries: fix parent_dn reference leak in add_dt_node()
Date: Wed, 20 Sep 2017 17:02:52 -0400	[thread overview]
Message-ID: <1505941372-9147-2-git-send-email-tyreld@linux.vnet.ibm.com> (raw)
In-Reply-To: <1505941372-9147-1-git-send-email-tyreld@linux.vnet.ibm.com>

A reference to the parent device node is held by add_dt_node() for the
node to be added. If the call to dlpar_configure_connector() fails
add_dt_node() returns ENOENT and that reference is not freed.

Add a call to of_node_put(parent_dn) prior to bailing out after a failed
dlpar_configure_connector() call.

Cc: stable@vger.kernel.org # v3.12+
Fixes: 8d5ff320766f ("powerpc/pseries: Make dlpar_configure_connector parent node aware")
Signed-off-by: Tyrel Datwyler <tyreld@linux.vnet.ibm.com>
---
 arch/powerpc/platforms/pseries/mobility.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/powerpc/platforms/pseries/mobility.c b/arch/powerpc/platforms/pseries/mobility.c
index 210ce63..f7042ad 100644
--- a/arch/powerpc/platforms/pseries/mobility.c
+++ b/arch/powerpc/platforms/pseries/mobility.c
@@ -226,8 +226,10 @@ static int add_dt_node(__be32 parent_phandle, __be32 drc_index)
 		return -ENOENT;
 
 	dn = dlpar_configure_connector(drc_index, parent_dn);
-	if (!dn)
+	if (!dn) {
+		of_node_put(parent_dn);
 		return -ENOENT;
+	}
 
 	rc = dlpar_attach_node(dn, parent_dn);
 	if (rc)
-- 
1.8.3.1

  reply	other threads:[~2017-09-20 21:03 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-15 11:04 [mainline][DLPAR][Oops] OF: ERROR: Bad of_node_put() on /cpus abdul
2017-09-15 12:52 ` Rob Herring
2017-09-19 13:36   ` Abdul Haleem
2017-09-20 11:39   ` Michael Ellerman
2017-09-20 17:23     ` Tyrel Datwyler
2017-09-21  9:57       ` Michael Ellerman
2017-09-21 18:48         ` Tyrel Datwyler
2017-09-22 11:59           ` Michael Ellerman
2017-09-20 21:02 ` [PATCH 1/2] powerpc/pseries: fix "OF: ERROR: Bad of_node_put() on /cpus" during DLPAR Tyrel Datwyler
2017-09-20 21:02   ` Tyrel Datwyler [this message]
2017-09-21  9:54   ` Michael Ellerman
2017-09-21 18:41     ` Tyrel Datwyler
2017-09-22  1:03   ` [1/2] " Michael Ellerman
2017-09-22 10:05     ` Abdul Haleem

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=1505941372-9147-2-git-send-email-tyreld@linux.vnet.ibm.com \
    --to=tyreld@linux.vnet.ibm.com \
    --cc=#@b01ledav001.gho.pok.ibm.com \
    --cc=abdhalee@linux.vnet.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=paulus@samba.org \
    --cc=robh+dt@kernel.org \
    --cc=sachinp@linux.vnet.ibm.com \
    --cc=stable@vger.kernel.org \
    --cc=v3.12+@b01ledav001.gho.pok.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).