Commit c9e15f25 authored by Greg KH's avatar Greg KH Committed by Greg Kroah-Hartman

debugfs: allow bad parent pointers to be passed in

If something went wrong with creating a debugfs file/symlink/directory,
that value could be passed down into debugfs again as a parent dentry.
To make caller code simpler, just error out if this happens, and don't
crash the kernel.
Reported-by: default avatarAlex Elder <elder@linaro.org>
Reviewed-by: default avatarViresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: default avatarAlex Elder <elder@linaro.org>
parent fdc81b79
...@@ -254,6 +254,9 @@ static struct dentry *start_creating(const char *name, struct dentry *parent) ...@@ -254,6 +254,9 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
pr_debug("debugfs: creating file '%s'\n",name); pr_debug("debugfs: creating file '%s'\n",name);
if (IS_ERR(parent))
return parent;
error = simple_pin_fs(&debug_fs_type, &debugfs_mount, error = simple_pin_fs(&debug_fs_type, &debugfs_mount,
&debugfs_mount_count); &debugfs_mount_count);
if (error) if (error)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment