[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <YEnmUEscWfcmDE+5@kroah.com>
Date: Thu, 11 Mar 2021 10:43:44 +0100
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: Petr Mladek <pmladek@...e.com>
Cc: Chris Down <chris@...isdown.name>, linux-kernel@...r.kernel.org,
Sergey Senozhatsky <sergey.senozhatsky@...il.com>,
John Ogness <john.ogness@...utronix.de>,
Johannes Weiner <hannes@...xchg.org>,
Andrew Morton <akpm@...ux-foundation.org>,
Steven Rostedt <rostedt@...dmis.org>,
Kees Cook <keescook@...omium.org>, kernel-team@...com
Subject: Re: [PATCH v5] printk: Userspace format enumeration support
On Thu, Mar 11, 2021 at 10:34:46AM +0100, Petr Mladek wrote:
> On Wed 2021-03-10 13:16:43, Greg Kroah-Hartman wrote:
> > On Wed, Mar 10, 2021 at 12:12:57PM +0000, Chris Down wrote:
> > > Greg Kroah-Hartman writes:
> > > > On Wed, Mar 10, 2021 at 02:30:31AM +0000, Chris Down wrote:
> > > > > + ps->file = debugfs_create_file(pi_get_module_name(mod), 0444, dfs_index,
> > > > > + ps, &dfs_index_fops);
> > > > > +
> > > > > + if (IS_ERR(ps->file)) {
> > > > > + pi_sec_remove(mod);
> > > > > + return;
> > > > > + }
> > > >
> > > > No need to check this and try to clean up if there is a problem, just
> > > > save the pointer off and call debugfs_remove() when you want to clean
> > > > up.
> > >
> > > Petr, what are your thoughts on this, since you requested the cleanup on
> > > debugfs failure? :-)
> >
> > There is nothing to "clean up" if there is a debugfs failure here so I
> > don't see the need.
>
> My main concern is that the allocated struct pi_sec must not be leaked
> when debugfs file was not created.
>
> I still have to check if it would be freed even without the file
> when the module is going out.
To me it looks like it still will happen as pi_sec_remove() will be
called either way.
thanks,
greg k-h
Powered by blists - more mailing lists