ice: fix NULL pointer dereference in ice_update_vsi_tx_ring_stats()
authorMaciej Fijalkowski <maciej.fijalkowski@intel.com>
Mon, 7 Mar 2022 17:47:39 +0000 (18:47 +0100)
committerTony Nguyen <anthony.l.nguyen@intel.com>
Tue, 15 Mar 2022 20:36:13 +0000 (13:36 -0700)
commitf153546913bada41a811722f2c6d17c3243a0333
tree1f7ac177d4fd1df52ef1e420412eb1f3b60ad1fd
parente9c14b59ea2ec19afe22d60b07583b7e08c74290
ice: fix NULL pointer dereference in ice_update_vsi_tx_ring_stats()

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@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com>
Acked-by: Alexander Lobakin <alexandr.lobakin@intel.com>
Tested-by: Gurucharan G <gurucharanx.g@intel.com> (A Contingent worker at Intel)
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
drivers/net/ethernet/intel/ice/ice_main.c