public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dmitriy Monakhov <dmonakhov@sw.ru>
To: Dmitriy Monakhov <dmonakhov@sw.ru>
Cc: linux-kernel@vger.kernel.org, gregkh@suse.de
Subject: Re: [patch] kobject: new_device->kref wasn't putted in kobject_move()
Date: Sat, 03 Mar 2007 16:11:21 +0300	[thread overview]
Message-ID: <87lkieqxom.fsf@sw.ru> (raw)
In-Reply-To: <87vehitrt2.fsf@sw.ru> (Dmitriy Monakhov's message of "Sat, 03 Mar 2007 15:50:01 +0300")

Dmitriy Monakhov <dmonakhov@sw.ru> writes:

> Signed-off-by: Monakhov Dmitriy <dmonakhov@openvz.org>
>
> diff --git a/lib/kobject.c b/lib/kobject.c
> index b94f208..b11f7b2 100644
> --- a/lib/kobject.c
> +++ b/lib/kobject.c
> @@ -432,6 +432,7 @@ int kobject_move(struct kobject *kobj, struct kobject *new_parent)
>  	kobject_put(old_parent);
>  	kobject_uevent_env(kobj, KOBJ_MOVE, envp);
>  out:
> +	kobject_put(new_parent);
>  	kobject_put(kobj);
>  	kfree(devpath_string);
>  	kfree(devpath);
OOps i'm realy sorry, by occasion patch was incomplete :(
The updated patch version following:

  [PATCH] kobject: new_device->kref wasn't putted after error in kobject_move()
  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>

diff --git a/lib/kobject.c b/lib/kobject.c
index b94f208..a6c9a06 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -429,9 +429,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);



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

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-03 12:50 [patch] kobject: new_device->kref wasn't putted in kobject_move() Dmitriy Monakhov
2007-03-03 13:11 ` Dmitriy Monakhov [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=87lkieqxom.fsf@sw.ru \
    --to=dmonakhov@sw.ru \
    --cc=gregkh@suse.de \
    --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