public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Greg Kroah-Hartman <gregkh@suse.de>
To: linux-kernel@vger.kernel.org
Cc: Dmitriy Monakhov <dmonakhov@sw.ru>,
	Monakhov Dmitriy <dmonakhov@openvz.org>,
	Greg Kroah-Hartman <gregkh@suse.de>
Subject: [PATCH 5/5] kobject: new_device->kref wasn't putted after error in kobject_move()
Date: Fri,  9 Mar 2007 20:07:32 -0800	[thread overview]
Message-ID: <11734996641158-git-send-email-gregkh@suse.de> (raw)
In-Reply-To: <11734996612279-git-send-email-gregkh@suse.de>

From: Dmitriy Monakhov <dmonakhov@sw.ru>

If error happen we jump to "out" label, in this case new_device not yet
became the parent but it wasn't putted.

Signed-off-by: Monakhov Dmitriy <dmonakhov@openvz.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 lib/kobject.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/lib/kobject.c b/lib/kobject.c
index f4f6176..057921c 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -385,9 +385,11 @@ int kobject_move(struct kobject *kobj, struct kobject *new_parent)
 		goto out;
 	old_parent = kobj->parent;
 	kobj->parent = new_parent;
+	new_parent = NULL;
 	kobject_put(old_parent);
 	kobject_uevent_env(kobj, KOBJ_MOVE, envp);
 out:
+	kobject_put(new_parent);
 	kobject_put(kobj);
 	kfree(devpath_string);
 	kfree(devpath);
-- 
1.5.0.2


      reply	other threads:[~2007-03-10  4:09 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-10  4:04 [GIT PATCH] Driver core fixes for 2.6.21-rc3 Greg KH
2007-03-10  4:07 ` [PATCH 1/5] Revert "driver core: refcounting fix" Greg Kroah-Hartman
2007-03-10  4:07   ` [PATCH 2/5] Driver core: add device symlink back to sysfs Greg Kroah-Hartman
2007-03-10  4:07     ` [PATCH 3/5] Remove devfs from MAINTAINERS Greg Kroah-Hartman
2007-03-10  4:07       ` [PATCH 4/5] driver core: export device_rename Greg Kroah-Hartman
2007-03-10  4:07         ` Greg Kroah-Hartman [this message]

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=11734996641158-git-send-email-gregkh@suse.de \
    --to=gregkh@suse.de \
    --cc=dmonakhov@openvz.org \
    --cc=dmonakhov@sw.ru \
    --cc=linux-kernel@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