Skip to content

Commit

Permalink
[PATCH] sysfs: handle failures in sysfs_make_dirent
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
rostedt authored and gregkh committed Jan 5, 2006
1 parent 8218ef8 commit e80a5de
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion fs/sysfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e80a5de

Please sign in to comment.