Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e80a5dea authored by Steven Rostedt's avatar Steven Rostedt Committed by Greg Kroah-Hartman
Browse files

[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: default avatarSteven Rostedt <rostedt@goodmis.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 8218ef80
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -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);