From e80a5dea8e056d8f398be1900d61c581d379f02f Mon Sep 17 00:00:00 2001 From: Steven Rostedt Date: Wed, 23 Nov 2005 09:15:44 -0500 Subject: [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 Signed-off-by: Greg Kroah-Hartman --- fs/sysfs/dir.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'fs') diff --git a/fs/sysfs/dir.c b/fs/sysfs/dir.c index 59734ba1ee6..d3678038217 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); -- cgit v1.2.3-70-g09d2