Commit f9fe0ca8 authored by Maneesh Soni's avatar Maneesh Soni Committed by Greg Kroah-Hartman

[PATCH] fix oops in sysfs_remove_dir()

The following patch should avoid the sysfs_remove_dir() oops you are
seeing while device removal. It anyway fixes the obvious error and is
needed. But it will not make any change to the first error you are
seeing while connecting the device.


o Following patch avoids the sysfs_remove_dir() oops when it is passed
  a kobject with NULL dentry.
Signed-off-by: default avatarManeesh Soni <maneesh@in.ibm.com>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 0e8a2de6
...@@ -268,7 +268,7 @@ void sysfs_remove_subdir(struct dentry * d) ...@@ -268,7 +268,7 @@ void sysfs_remove_subdir(struct dentry * d)
void sysfs_remove_dir(struct kobject * kobj) void sysfs_remove_dir(struct kobject * kobj)
{ {
struct dentry * dentry = dget(kobj->dentry); struct dentry * dentry = dget(kobj->dentry);
struct sysfs_dirent * parent_sd = dentry->d_fsdata; struct sysfs_dirent * parent_sd;
struct sysfs_dirent * sd, * tmp; struct sysfs_dirent * sd, * tmp;
if (!dentry) if (!dentry)
...@@ -276,6 +276,7 @@ void sysfs_remove_dir(struct kobject * kobj) ...@@ -276,6 +276,7 @@ void sysfs_remove_dir(struct kobject * kobj)
pr_debug("sysfs %s: removing dir\n",dentry->d_name.name); pr_debug("sysfs %s: removing dir\n",dentry->d_name.name);
down(&dentry->d_inode->i_sem); down(&dentry->d_inode->i_sem);
parent_sd = dentry->d_fsdata;
list_for_each_entry_safe(sd, tmp, &parent_sd->s_children, s_sibling) { list_for_each_entry_safe(sd, tmp, &parent_sd->s_children, s_sibling) {
if (!sd->s_element || !(sd->s_type & SYSFS_NOT_PINNED)) if (!sd->s_element || !(sd->s_type & SYSFS_NOT_PINNED))
continue; continue;
......
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