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: <20221130082303.30859-2-andrew.yang@mediatek.com>
Date:   Wed, 30 Nov 2022 16:23:03 +0800
From:   Andrew Yang <andrew.yang@...iatek.com>
To:     <rostedt@...dmis.org>
CC:     <andrew.yang@...iatek.com>, <casper.li@...iatek.com>,
        <linux-arm-kernel@...ts.infradead.org>,
        <linux-kernel@...r.kernel.org>,
        <linux-mediatek@...ts.infradead.org>, <matthias.bgg@...il.com>,
        <mhiramat@...nel.org>
Subject: Re: [PATCH v2] mm/writeback: fix dereferencing NULL mapping->host

On Tue, 2022-11-29 at 09:56 -0500, Steven Rostedt wrote:
> On Tue, 29 Nov 2022 11:32:59 +0800
> Andrew Yang <andrew.yang@...iatek.com> wrote:
> 
> > From: "andrew.yang" <andrew.yang@...iatek.com>
> > 
> > Check before dereferencing mapping->host
> > 
> > Signed-off-by: andrew.yang <andrew.yang@...iatek.com>
> > ---
> >  include/trace/events/writeback.h | 2 +-
> >  1 file changed, 1 insertion(+), 1 deletion(-)
> > 
> > diff --git a/include/trace/events/writeback.h
> > b/include/trace/events/writeback.h
> > index 86b2a82da546..56f6e114d3ed 100644
> > --- a/include/trace/events/writeback.h
> > +++ b/include/trace/events/writeback.h
> > @@ -68,7 +68,7 @@ DECLARE_EVENT_CLASS(writeback_folio_template,
> >  		strscpy_pad(__entry->name,
> >  			    bdi_dev_name(mapping ?
> > inode_to_bdi(mapping->host) :
> >  					 NULL), 32);
> > -		__entry->ino = mapping ? mapping->host->i_ino : 0;
> > +		__entry->ino = mapping && mapping->host ? mapping-
> > >host->i_ino : 0;
> 
> I hate remembering precedence. Can we add parenthesis around this to
> be
> clear?
> 
> 		__entry->ino = (mapping && mapping->host) ? mapping-
> >host->i_ino : 0;
> 
> Thanks,
> 
> -- Steve
> 
> 
> >  		__entry->index = folio->index;
> >  	),
> >  
> 
> 
Sure, that's a good suggestion

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ