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] [thread-next>] [day] [month] [year] [list]
Message-ID: <e0d1a5caf1714f303ae89c909dfa4d04ebdde3e4.camel@intel.com>
Date:   Wed, 16 Mar 2022 19:00:39 +0000
From:   "Nguyen, Anthony L" <anthony.l.nguyen@...el.com>
To:     "alexander.duyck@...il.com" <alexander.duyck@...il.com>,
        "kuba@...nel.org" <kuba@...nel.org>
CC:     lkp <lkp@...el.com>,
        "Karlsson, Magnus" <magnus.karlsson@...el.com>,
        "davem@...emloft.net" <davem@...emloft.net>,
        "Lobakin, Alexandr" <alexandr.lobakin@...el.com>,
        "Fijalkowski, Maciej" <maciej.fijalkowski@...el.com>,
        "dan.carpenter@...cle.com" <dan.carpenter@...cle.com>,
        "pabeni@...hat.com" <pabeni@...hat.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "G, GurucharanX" <gurucharanx.g@...el.com>
Subject: Re: [PATCH net 1/3] ice: fix NULL pointer dereference in
 ice_update_vsi_tx_ring_stats()

On Tue, 2022-03-15 at 20:29 -0700, Jakub Kicinski wrote:
> On Tue, 15 Mar 2022 14:12:23 -0700 Tony Nguyen wrote:
> > From: Maciej Fijalkowski <maciej.fijalkowski@...el.com>
> > 
> > It is possible to do NULL pointer dereference in routine that
> > updates
> > Tx ring stats. Currently only stats and bytes are updated when ring
> 
> s/stats/packets/ ?

Will fix.

> 
> > pointer is valid, but later on ring is accessed to propagate
> > gathered Tx
> > stats onto VSI stats.
> > 
> > Change the existing logic to move to next ring when ring is NULL.
> > 
> > Fixes: e72bba21355d ("ice: split ice_ring onto Tx/Rx separate
> > structs")
> > Reported-by: kernel test robot <lkp@...el.com>
> > Reported-by: Dan Carpenter <dan.carpenter@...cle.com>
> > Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@...el.com>
> > Acked-by: Alexander Lobakin <alexandr.lobakin@...el.com>
> > Tested-by: Gurucharan G <gurucharanx.g@...el.com> (A Contingent
> > worker at Intel)
> > Signed-off-by: Tony Nguyen <anthony.l.nguyen@...el.com>
> > ---
> >  drivers/net/ethernet/intel/ice/ice_main.c | 5 +++--
> >  1 file changed, 3 insertions(+), 2 deletions(-)
> > 
> > diff --git a/drivers/net/ethernet/intel/ice/ice_main.c
> > b/drivers/net/ethernet/intel/ice/ice_main.c
> > index 493942e910be..d4a7c39fd078 100644
> > --- a/drivers/net/ethernet/intel/ice/ice_main.c
> > +++ b/drivers/net/ethernet/intel/ice/ice_main.c
> > @@ -5962,8 +5962,9 @@ ice_update_vsi_tx_ring_stats(struct ice_vsi
> > *vsi,
> >                 u64 pkts = 0, bytes = 0;
> >  
> >                 ring = READ_ONCE(rings[i]);
> 
> Not really related to this patch but why is there a read_once() here?
> Aren't stats read under rtnl_lock? What is this protecting against?

It looks like it was based on a patch from i40e [1]. From the commit, I
gather this is the reason:

"Previously the stats were 64 bit but highly racy due to the fact that
64 bit transactions are not atomic on 32 bit systems."

Thanks,

Tony

[1]
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=980e9b1186424fa3eb766d59fc91003d0ed1ed6a


(Resending as some non-text formatting snuck in to my reply. Sorry for
the spam)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ