Преглед на файлове

[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>
Steven Rostedt преди 19 години
родител
ревизия
e80a5dea8e
променени са 1 файла, в които са добавени 5 реда и са изтрити 1 реда
  1. 5 1
      fs/sysfs/dir.c

+ 5 - 1
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);