Skip to content

Commit 0db4a47

Browse files
Colin Ian KingJeff Kirsher
authored andcommitted
ixgbe: don't clear_bit on xdp_ring->state if xdp_ring is null
There is an earlier check to see if xdp_ring is null when configuring the tx ring, so assuming that it can still be null, the clearing of the xdp_ring->state currently could end up with a null pointer dereference. Fix this by only clearing the bit if xdp_ring is not null. Detected by CoverityScan, CID#1473795 ("Dereference after null check") Fixes: 024aa58 ("ixgbe: added Rx/Tx ring disable/enable functions") Signed-off-by: Colin Ian King <[email protected]> Tested-by: Andrew Bowers <[email protected]> Signed-off-by: Jeff Kirsher <[email protected]>
1 parent b860772 commit 0db4a47

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/ethernet/intel/ixgbe/ixgbe_main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10517,7 +10517,8 @@ void ixgbe_txrx_ring_enable(struct ixgbe_adapter *adapter, int ring)
1051710517
ixgbe_configure_rx_ring(adapter, rx_ring);
1051810518

1051910519
clear_bit(__IXGBE_TX_DISABLED, &tx_ring->state);
10520-
clear_bit(__IXGBE_TX_DISABLED, &xdp_ring->state);
10520+
if (xdp_ring)
10521+
clear_bit(__IXGBE_TX_DISABLED, &xdp_ring->state);
1052110522
}
1052210523

1052310524
/**

0 commit comments

Comments
 (0)