From: Maneesh Soni <maneesh@in.ibm.com>
The following patch fixes the dentry refcounting, during
sysfs_remove_group() and also adds the missing dput() for the "extra" ref
taken during sysfs_create() for the sub-directory dentry corresponding to
attribute group.
if ((error = create_files(dir,grp))) {
if (grp->name)
sysfs_remove_subdir(dir);
- dput(dir);
}
+ dput(dir);
return error;
}
if (grp->name)
dir = sysfs_get_dentry(kobj->dentry,grp->name);
else
- dir = kobj->dentry;
+ dir = dget(kobj->dentry);
remove_files(dir,grp);
- dput(dir);
if (grp->name)
sysfs_remove_subdir(dir);
+ /* release the ref. taken in this routine */
+ dput(dir);
}