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

Commit 63223a06 authored by Mathieu Desnoyers's avatar Mathieu Desnoyers Committed by Greg Kroah-Hartman
Browse files

DebugFS : file/directory creation error handling



Fix error handling of file and directory creation in DebugFS.

The error path should release the file system because no _remove will be called
for this erroneous creation.

Signed-off-by: default avatarMathieu Desnoyers <mathieu.desnoyers@polymtl.ca>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent bafb232e
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -206,13 +206,15 @@ struct dentry *debugfs_create_file(const char *name, mode_t mode,


	pr_debug("debugfs: creating file '%s'\n",name);
	pr_debug("debugfs: creating file '%s'\n",name);


	error = simple_pin_fs(&debug_fs_type, &debugfs_mount, &debugfs_mount_count);
	error = simple_pin_fs(&debug_fs_type, &debugfs_mount,
			      &debugfs_mount_count);
	if (error)
	if (error)
		goto exit;
		goto exit;


	error = debugfs_create_by_name(name, mode, parent, &dentry);
	error = debugfs_create_by_name(name, mode, parent, &dentry);
	if (error) {
	if (error) {
		dentry = NULL;
		dentry = NULL;
		simple_release_fs(&debugfs_mount, &debugfs_mount_count);
		goto exit;
		goto exit;
	}
	}