summaryrefslogtreecommitdiffstats
path: root/fs/debugfs
diff options
context:
space:
mode:
authorGreg KH <gregkh@linuxfoundation.org>2015-03-30 14:59:15 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2015-04-03 16:30:12 +0200
commitc9e15f25f514a76d906be01e621f400cdee94558 (patch)
treefe2cbbcae6a9870adc803dc9f1ecd11da2063aa7 /fs/debugfs
parentfdc81b7910ad5153bf257e5f7861be71f75a02ef (diff)
downloadop-kernel-dev-c9e15f25f514a76d906be01e621f400cdee94558.zip
op-kernel-dev-c9e15f25f514a76d906be01e621f400cdee94558.tar.gz
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: Alex Elder <elder@linaro.org> Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Reviewed-by: Alex Elder <elder@linaro.org>
Diffstat (limited to 'fs/debugfs')
-rw-r--r--fs/debugfs/inode.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c
index 96400ab..61e72d4 100644
--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -254,6 +254,9 @@ static struct dentry *start_creating(const char *name, struct dentry *parent)
pr_debug("debugfs: creating file '%s'\n",name);
+ if (IS_ERR(parent))
+ return parent;
+
error = simple_pin_fs(&debug_fs_type, &debugfs_mount,
&debugfs_mount_count);
if (error)
OpenPOWER on IntegriCloud