Skip to content

Commit

Permalink
debugfs: allow bad parent pointers to be passed in
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Viresh Kumar <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
Reviewed-by: Alex Elder <[email protected]>
  • Loading branch information
gregkh committed Apr 3, 2015
1 parent fdc81b7 commit c9e15f2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions fs/debugfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit c9e15f2

Please sign in to comment.