Patch "ice: fix NULL pointer dereference in ice_update_vsi_tx_ring_stats()" has been added to the 5.16-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    ice: fix NULL pointer dereference in ice_update_vsi_tx_ring_stats()

to the 5.16-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     ice-fix-null-pointer-dereference-in-ice_update_vsi_t.patch
and it can be found in the queue-5.16 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 74cea2dc72796aafbb70b161785b39a2ae50e282
Author: Maciej Fijalkowski <maciej.fijalkowski@xxxxxxxxx>
Date:   Mon Mar 7 18:47:39 2022 +0100

    ice: fix NULL pointer dereference in ice_update_vsi_tx_ring_stats()
    
    [ Upstream commit f153546913bada41a811722f2c6d17c3243a0333 ]
    
    It is possible to do NULL pointer dereference in routine that updates
    Tx ring stats. Currently only stats and bytes are updated when ring
    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@xxxxxxxxx>
    Reported-by: Dan Carpenter <dan.carpenter@xxxxxxxxxx>
    Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@xxxxxxxxx>
    Acked-by: Alexander Lobakin <alexandr.lobakin@xxxxxxxxx>
    Tested-by: Gurucharan G <gurucharanx.g@xxxxxxxxx> (A Contingent worker at Intel)
    Signed-off-by: Tony Nguyen <anthony.l.nguyen@xxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 8a6c3716cdab..b449b3408a1c 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -5972,8 +5972,9 @@ ice_update_vsi_tx_ring_stats(struct ice_vsi *vsi,
 		u64 pkts = 0, bytes = 0;
 
 		ring = READ_ONCE(rings[i]);
-		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);
 		vsi_stats->tx_packets += pkts;
 		vsi_stats->tx_bytes += bytes;
 		vsi->tx_restart += ring->tx_stats.restart_q;



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux