]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] sysfs: handle failures in sysfs_make_dirent
authorSteven Rostedt <rostedt@goodmis.org>
Wed, 23 Nov 2005 14:15:44 +0000 (09:15 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 5 Jan 2006 00:18:09 +0000 (16:18 -0800)
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>
fs/sysfs/dir.c

index 59734ba1ee6026556af405cfe77a6bf21f30084e..d367803821760883ce6d1043ef7aec5c470145f9 100644 (file)
@@ -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);