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

[PATCH] Fix dentry refcounting in sysfs_remove_group()

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.
parent f8f71d1b
......@@ -55,8 +55,8 @@ int sysfs_create_group(struct kobject * kobj,
if ((error = create_files(dir,grp))) {
if (grp->name)
sysfs_remove_subdir(dir);
dput(dir);
}
dput(dir);
return error;
}
......@@ -68,12 +68,13 @@ void sysfs_remove_group(struct kobject * kobj,
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);
}
......
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