Commit e80a5dea authored by Steven Rostedt's avatar Steven Rostedt Committed by Greg Kroah-Hartman

[PATCH] sysfs: handle failures in sysfs_make_dirent

I noticed that if sysfs_make_dirent fails to allocate the sd, then a
null will be passed to sysfs_put.
Signed-off-by: default avatarSteven Rostedt <rostedt@goodmis.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 8218ef80
......@@ -112,7 +112,11 @@ static int create_dir(struct kobject * k, struct dentry * p,
}
}
if (error && (error != -EEXIST)) {
sysfs_put((*d)->d_fsdata);
struct sysfs_dirent *sd = (*d)->d_fsdata;
if (sd) {
list_del_init(&sd->s_sibling);
sysfs_put(sd);
}
d_drop(*d);
}
dput(*d);
......
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