public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [patch] kobject: new_device->kref wasn't putted in kobject_move()
@ 2007-03-03 12:50 Dmitriy Monakhov
  2007-03-03 13:11 ` Dmitriy Monakhov
  0 siblings, 1 reply; 2+ messages in thread
From: Dmitriy Monakhov @ 2007-03-03 12:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: gregkh

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);


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [patch] kobject: new_device->kref wasn't putted in kobject_move()
  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
  0 siblings, 0 replies; 2+ messages in thread
From: Dmitriy Monakhov @ 2007-03-03 13:11 UTC (permalink / raw)
  To: Dmitriy Monakhov; +Cc: linux-kernel, gregkh

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);



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-03-03 13:10 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox