2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-11-18 23:54:26 +08:00

[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: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
This commit is contained in:
Steven Rostedt 2005-11-23 09:15:44 -05:00 committed by Greg Kroah-Hartman
parent 8218ef8093
commit e80a5dea8e

View File

@ -112,7 +112,11 @@ static int create_dir(struct kobject * k, struct dentry * p,
} }
} }
if (error && (error != -EEXIST)) { 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); d_drop(*d);
} }
dput(*d); dput(*d);