diff options
author | Steven Rostedt <rostedt@goodmis.org> | 2005-11-23 09:15:44 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-01-04 19:18:09 -0500 |
commit | e80a5dea8e056d8f398be1900d61c581d379f02f (patch) | |
tree | 97d6e0d1c669987c54961bec49347b3717e55d52 /fs/sysfs | |
parent | 8218ef80932aa7e5e3d20c929a640c8d82133a9a (diff) |
[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>
Diffstat (limited to 'fs/sysfs')
-rw-r--r-- | fs/sysfs/dir.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 59734ba1ee60..d36780382176 100644 --- a/fs/sysfs/dir.c +++ b/fs/sysfs/dir.c | |||
@@ -112,7 +112,11 @@ static int create_dir(struct kobject * k, struct dentry * p, | |||
112 | } | 112 | } |
113 | } | 113 | } |
114 | if (error && (error != -EEXIST)) { | 114 | if (error && (error != -EEXIST)) { |
115 | sysfs_put((*d)->d_fsdata); | 115 | struct sysfs_dirent *sd = (*d)->d_fsdata; |
116 | if (sd) { | ||
117 | list_del_init(&sd->s_sibling); | ||
118 | sysfs_put(sd); | ||
119 | } | ||
116 | d_drop(*d); | 120 | d_drop(*d); |
117 | } | 121 | } |
118 | dput(*d); | 122 | dput(*d); |