Commit b7e72582 authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] fix sysfs oops

From: Greg KH <greg@kroah.com>

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 <mgorse@mgorse.dhs.org>
parent dc8d3e60
...@@ -83,6 +83,7 @@ static void remove_dir(struct dentry * d) ...@@ -83,6 +83,7 @@ static void remove_dir(struct dentry * d)
struct dentry * parent = dget(d->d_parent); struct dentry * parent = dget(d->d_parent);
down(&parent->d_inode->i_sem); down(&parent->d_inode->i_sem);
d_delete(d); d_delete(d);
if (d->d_inode)
simple_rmdir(parent->d_inode,d); simple_rmdir(parent->d_inode,d);
pr_debug(" o %s removing done (%d)\n",d->d_name.name, pr_debug(" o %s removing done (%d)\n",d->d_name.name,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment