From rostedt@goodmis.org Wed Nov 23 06:17:26 2005 Subject: sysfs: handle failures in sysfs_make_dirent From: Steven Rostedt To: Cc: Greg KH , Ingo Molnar Date: Wed, 23 Nov 2005 09:15:44 -0500 Message-Id: <1132755344.13395.32.camel@localhost.localdomain> 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 Signed-off-by: Greg Kroah-Hartman --- fs/sysfs/dir.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) --- gregkh-2.6.orig/fs/sysfs/dir.c +++ gregkh-2.6/fs/sysfs/dir.c @@ -112,7 +112,11 @@ static int create_dir(struct kobject * k } } 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);