summaryrefslogtreecommitdiffstats
path: root/fs/sysfs/dir.c
diff options
context:
space:
mode:
authorSteven Rostedt2005-11-23 15:15:44 +0100
committerGreg Kroah-Hartman2006-01-05 01:18:09 +0100
commite80a5dea8e056d8f398be1900d61c581d379f02f (patch)
tree97d6e0d1c669987c54961bec49347b3717e55d52 /fs/sysfs/dir.c
parent[PATCH] Driver core: Make block devices create the proper symlink name (diff)
downloadkernel-qcow2-linux-e80a5dea8e056d8f398be1900d61c581d379f02f.tar.gz
kernel-qcow2-linux-e80a5dea8e056d8f398be1900d61c581d379f02f.tar.xz
kernel-qcow2-linux-e80a5dea8e056d8f398be1900d61c581d379f02f.zip
[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/dir.c')
-rw-r--r--fs/sysfs/dir.c6
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,
}
}
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);