lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190221091022.GB11118@kroah.com>
Date:   Thu, 21 Feb 2019 10:10:22 +0100
From:   Greg KH <gregkh@...uxfoundation.org>
To:     Michal Hocko <mhocko@...nel.org>
Cc:     Yue Hu <zbestahu@...il.com>, akpm@...ux-foundation.org,
        rientjes@...gle.com, joe@...ches.com, linux-mm@...ck.org,
        linux-kernel@...r.kernel.org, huyue2@...ong.com
Subject: Re: [PATCH] mm/cma_debug: Check for null tmp in cma_debugfs_add_one()

On Thu, Feb 21, 2019 at 09:45:25AM +0100, Michal Hocko wrote:
> On Thu 21-02-19 09:36:24, Greg KH wrote:
> > On Thu, Feb 21, 2019 at 09:23:09AM +0100, Michal Hocko wrote:
> > > On Thu 21-02-19 12:01:30, Yue Hu wrote:
> > > > From: Yue Hu <huyue2@...ong.com>
> > > > 
> > > > If debugfs_create_dir() failed, the following debugfs_create_file()
> > > > will be meanless since it depends on non-NULL tmp dentry and it will
> > > > only waste CPU resource.
> > > 
> > > The file will be created in the debugfs root. But, more importantly.
> > > Greg (CCed now) is working on removing the failure paths because he
> > > believes they do not really matter for debugfs and they make code more
> > > ugly. More importantly a check for NULL is not correct because you
> > > get ERR_PTR after recent changes IIRC.
> > > 
> > > > 
> > > > Signed-off-by: Yue Hu <huyue2@...ong.com>
> > > > ---
> > > >  mm/cma_debug.c | 2 ++
> > > >  1 file changed, 2 insertions(+)
> > > > 
> > > > diff --git a/mm/cma_debug.c b/mm/cma_debug.c
> > > > index 2c2c869..3e9d984 100644
> > > > --- a/mm/cma_debug.c
> > > > +++ b/mm/cma_debug.c
> > > > @@ -169,6 +169,8 @@ static void cma_debugfs_add_one(struct cma *cma, struct dentry *root_dentry)
> > > >  	scnprintf(name, sizeof(name), "cma-%s", cma->name);
> > > >  
> > > >  	tmp = debugfs_create_dir(name, root_dentry);
> > > > +	if (!tmp)
> > > > +		return;
> > 
> > Ick, yes, this patch isn't ok, I've been doing lots of work to rip these
> > checks out :)
> 
> Btw. I believe that it would help to clarify this stance in the
> kerneldoc otherwise these checks will be returning back because the
> general kernel development attitude is to check for errors. As I've said
> previously debugfs being different is ugly but decision is yours.

Yes, I'll be doing that, thanks for the reminder.

greg k-h

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ