Skip to contentSkip to conversation

fix sysfs oops [1/4]

PATCH New Greg KH 1 participant 1 message Dec 23, 2003 Driver core

lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 fix sysfs oops [1/4]

This fixes an oops when a kobject is unregistered before it's child is. The usb-serial devices show this bug very easily (yank out a device while its port is opened...)

Patch was originally written by Mike Gorse <[email protected]>

fs/sysfs/dir.c +2 -1
diff -Nru a/fs/sysfs/dir.c b/fs/sysfs/dir.c
@@ -83,7 +83,8 @@
 	struct dentry * parent = dget(d->d_parent);
 	down(&parent->d_inode->i_sem);
 	d_delete(d);
-	simple_rmdir(parent->d_inode,d);
+	if (d->d_inode)
+		simple_rmdir(parent->d_inode,d);
 
 	pr_debug(" o %s removing done (%d)\n",d->d_name.name,
 		 atomic_read(&d->d_count));

-------------------------------------------------------
This SF.net email is sponsored by: IBM Linux Tutorials. Become an expert in LINUX or just sharpen your skills. Sign up for IBM's Free Linux Tutorials. Learn everything from the bash shell to sys admin. Click now! http://ads.osdn.com/?ad_id78&alloc_id371&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel