From: Greg KH Date: Mon, 30 Mar 2015 12:59:15 +0000 (+0200) Subject: debugfs: allow bad parent pointers to be passed in X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=c9e15f25f514a76d906be01e621f400cdee94558;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Reviewed-by: Viresh Kumar Signed-off-by: Greg Kroah-Hartman Reviewed-by: Alex Elder --- diff --git a/fs/debugfs/inode.c b/fs/debugfs/inode.c index 96400ab42d13..61e72d44cf94 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)