linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] kobject: fix double kobject_put in kobject_unregister()
@ 2004-11-10 22:19 Keshavamurthy Anil S
  2004-11-10 22:30 ` Russell King
  2004-11-10 22:54 ` Greg KH
  0 siblings, 2 replies; 7+ messages in thread
From: Keshavamurthy Anil S @ 2004-11-10 22:19 UTC (permalink / raw)
  To: Greg KH; +Cc: Hotplug List, Linux Kernel

Hi Greg,
	
This patch fixes the problem where in kobject resources were getting
freed when those kobject were still in use due to double kobject_put()
getting called in the kobject_unregister() code path.

With out this patch kobject_unregister() will have some serious side effects.

Please apply.

signed-off-by: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>


 linux-2.6.10-rc1-mm4-askeshav/lib/kobject.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletion(-)

diff -puN lib/kobject.c~kobject_unregister_fix lib/kobject.c
--- linux-2.6.10-rc1-mm4/lib/kobject.c~kobject_unregister_fix	2004-11-10 13:43:42.243877455 -0800
+++ linux-2.6.10-rc1-mm4-askeshav/lib/kobject.c	2004-11-10 13:46:30.788797265 -0800
@@ -301,6 +301,8 @@ void kobject_del(struct kobject * kobj)
 {
 	kobject_hotplug(kobj, KOBJ_REMOVE);
 	sysfs_remove_dir(kobj);
+
+	/* unlink does kobject_put() for us */
 	unlink(kobj);
 }
 
@@ -313,7 +315,6 @@ void kobject_unregister(struct kobject *
 {
 	pr_debug("kobject %s: unregistering\n",kobject_name(kobj));
 	kobject_del(kobj);
-	kobject_put(kobj);
 }
 
 /**
_


-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_idU88&alloc_id\x12065&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

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

end of thread, other threads:[~2004-11-11  2:03 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-10 22:19 [PATCH] kobject: fix double kobject_put in kobject_unregister() Keshavamurthy Anil S
2004-11-10 22:30 ` Russell King
2004-11-10 22:39   ` Keshavamurthy Anil S
2004-11-10 22:54 ` Greg KH
2004-11-10 23:04   ` Keshavamurthy Anil S
2004-11-11  2:03     ` Keiichiro Tokunaga
2004-11-11  1:54   ` Keshavamurthy Anil S

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