[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220315202941.64319c5e@kicinski-fedora-pc1c0hjn.dhcp.thefacebook.com>
Date: Tue, 15 Mar 2022 20:29:41 -0700
From: Jakub Kicinski <kuba@...nel.org>
To: Tony Nguyen <anthony.l.nguyen@...el.com>
Cc: davem@...emloft.net, pabeni@...hat.com,
Maciej Fijalkowski <maciej.fijalkowski@...el.com>,
netdev@...r.kernel.org, magnus.karlsson@...el.com,
kernel test robot <lkp@...el.com>,
Dan Carpenter <dan.carpenter@...cle.com>,
Alexander Lobakin <alexandr.lobakin@...el.com>,
Gurucharan G <gurucharanx.g@...el.com>
Subject: Re: [PATCH net 1/3] ice: fix NULL pointer dereference in
ice_update_vsi_tx_ring_stats()
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/ ?
> 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?
> - if (ring)
> - ice_fetch_u64_stats_per_ring(&ring->syncp, ring->stats, &pkts, &bytes);
> + if (!ring)
> + continue;
> + ice_fetch_u64_stats_per_ring(&ring->syncp, ring->stats, &pkts, &bytes);
Powered by blists - more mailing lists