debugfs: allow bad parent pointers to be passed in
Greg KH
maintainerPATCH 1/1 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.
--- fs/debugfs/inode.c | 3 +++ 1 file changed, 3 insertions(+)
fs/debugfs/inode.c +3 -0
@@ -254,6 +254,9 @@ static struct dentry *start_creating(conpr_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)
Quoted 16 lines · Greg KH
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]>Cc Viresh Kumar <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>--- fs/debugfs/inode.c | 3 +++ 1 file changed, 3 insertions(+)
fs/debugfs/inode.c static struct dentry *start_creating(con · line 262
Quoted 9 lines
fs/debugfs/inode.c +3
-0@@ -254,6 +254,9 @@ static struct dentry *start_creating(conpr_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)
Quoted 8 lines · Greg KH
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]>Cc Viresh Kumar <[email protected]>Signed-off-by Greg Kroah-Hartman <[email protected]>
Looks good.
Quoted 18 lines
--- fs/debugfs/inode.c | 3 +++ 1 file changed, 3 insertions(+)fs/debugfs/inode.c +3
-0@@ -254,6 +254,9 @@ static struct dentry *start_creating(conpr_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)