All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] debugfs: allow bad parent pointers to be passed in
@ 2015-03-30 12:59 Greg KH
  2015-03-30 13:07 ` Viresh Kumar
  2015-03-30 17:08 ` Alex Elder
  0 siblings, 2 replies; 3+ messages in thread
From: Greg KH @ 2015-03-30 12:59 UTC (permalink / raw)
  To: linux-kernel; +Cc: Alex Elder, Viresh Kumar

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>
Cc: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
 fs/debugfs/inode.c |    3 +++
 1 file changed, 3 insertions(+)

--- a/fs/debugfs/inode.c
+++ b/fs/debugfs/inode.c
@@ -254,6 +254,9 @@ static struct dentry *start_creating(con
 
 	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)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] debugfs: allow bad parent pointers to be passed in
  2015-03-30 12:59 [PATCH] debugfs: allow bad parent pointers to be passed in Greg KH
@ 2015-03-30 13:07 ` Viresh Kumar
  2015-03-30 17:08 ` Alex Elder
  1 sibling, 0 replies; 3+ messages in thread
From: Viresh Kumar @ 2015-03-30 13:07 UTC (permalink / raw)
  To: Greg KH; +Cc: Linux Kernel Mailing List, Alex Elder

On 30 March 2015 at 18:29, Greg KH <gregkh@linuxfoundation.org> wrote:
> 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>
> Cc: Viresh Kumar <viresh.kumar@linaro.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
>
> ---
>  fs/debugfs/inode.c |    3 +++
>  1 file changed, 3 insertions(+)
>
> --- a/fs/debugfs/inode.c
> +++ b/fs/debugfs/inode.c
> @@ -254,6 +254,9 @@ static struct dentry *start_creating(con
>
>         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)

Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] debugfs: allow bad parent pointers to be passed in
  2015-03-30 12:59 [PATCH] debugfs: allow bad parent pointers to be passed in Greg KH
  2015-03-30 13:07 ` Viresh Kumar
@ 2015-03-30 17:08 ` Alex Elder
  1 sibling, 0 replies; 3+ messages in thread
From: Alex Elder @ 2015-03-30 17:08 UTC (permalink / raw)
  To: Greg KH, linux-kernel; +Cc: Viresh Kumar

On 03/30/2015 07:59 AM, Greg KH wrote:
> 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>
> Cc: Viresh Kumar <viresh.kumar@linaro.org>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

Looks good.

Reviewed-by: Alex Elder <elder@linaro.org>

> 
> ---
>  fs/debugfs/inode.c |    3 +++
>  1 file changed, 3 insertions(+)
> 
> --- a/fs/debugfs/inode.c
> +++ b/fs/debugfs/inode.c
> @@ -254,6 +254,9 @@ static struct dentry *start_creating(con
>  
>  	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)
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-03-30 17:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-03-30 12:59 [PATCH] debugfs: allow bad parent pointers to be passed in Greg KH
2015-03-30 13:07 ` Viresh Kumar
2015-03-30 17:08 ` Alex Elder

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.