Re: [PATCH 2/2] debugfs: return error values, not NULL

From: Greg Kroah-Hartman
Date: Mon Jan 28 2019 - 11:04:36 EST


On Mon, Jan 28, 2019 at 10:55:13PM +0900, Masami Hiramatsu wrote:
> Hi Greg,
>
> On Thu, 24 Jan 2019 11:26:52 +0900
> Masami Hiramatsu <mhiramat@xxxxxxxxxx> wrote:
>
> > On Wed, 23 Jan 2019 11:28:14 +0100
> > Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx> wrote:
> >
> > > When an error happens, debugfs should return an error pointer value, not
> > > NULL. This will prevent the totally theoretical error where a debugfs
> > > call fails due to lack of memory, returning NULL, and that dentry value
> > > is then passed to another debugfs call, which would end up succeeding,
> > > creating a file at the root of the debugfs tree, but would then be
> > > impossible to remove (because you can not remove the directory NULL).
> > >
> > > So, to make everyone happy, always return errors, this makes the users
> > > of debugfs much simpler (they do not have to ever check the return
> > > value), and everyone can rest easy.
> >
> > With Greg's return check removal patches, I'm OK for this change.
> >
> > Reviewed-by: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
> >
> > Thank you,
> >
> > >
> > > Reported-by: Masami Hiramatsu <mhiramat@xxxxxxxxxx>
> > > Reported-by: Ulf Hansson <ulf.hansson@xxxxxxxxxx>
> > > Reported-by: Gary R Hook <ghook@xxxxxxx>
> > > Reported-by: Heiko Carstens <heiko.carstens@xxxxxxxxxx>
> > > Cc: stable <stable@xxxxxxxxxxxxxxx>
>
> BTW, would you really think it should go to stable? It seems an improvement
> instead of a bugfix...

See later in the thread, I decided that was not the correct thing to do
:)

thanks,

greg k-h