Skip to content

Commit 024a816

Browse files
Francesco Ruggerianguy11
authored andcommitted
igb: reinit_locked() should be called with rtnl_lock
We observed two panics involving races with igb_reset_task. The first panic is caused by this race condition: kworker reboot -f igb_reset_task igb_reinit_locked igb_down napi_synchronize __igb_shutdown igb_clear_interrupt_scheme igb_free_q_vectors igb_free_q_vector adapter->q_vector[v_idx] = NULL; napi_disable Panics trying to access adapter->q_vector[v_idx].napi_state The second panic (a divide error) is caused by this race: kworker reboot -f tx packet igb_reset_task __igb_shutdown rtnl_lock() ... igb_clear_interrupt_scheme igb_free_q_vectors adapter->num_tx_queues = 0 ... rtnl_unlock() rtnl_lock() igb_reinit_locked igb_down igb_up netif_tx_start_all_queues dev_hard_start_xmit igb_xmit_frame igb_tx_queue_mapping Panics on r_idx % adapter->num_tx_queues This commit applies to igb_reset_task the same changes that were applied to ixgbe in commit 2f90b86 ("ixgbe: this patch adds support for DCB to the kernel and ixgbe driver"), commit 8f4c5c9 ("ixgbe: reinit_locked() should be called with rtnl_lock") and commit 88adce4 ("ixgbe: fix possible race in reset subtask"). Signed-off-by: Francesco Ruggeri <[email protected]> Tested-by: Aaron Brown <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 1050242 commit 024a816

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

drivers/net/ethernet/intel/igb/igb_main.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6224,9 +6224,18 @@ static void igb_reset_task(struct work_struct *work)
62246224
struct igb_adapter *adapter;
62256225
adapter = container_of(work, struct igb_adapter, reset_task);
62266226

6227+
rtnl_lock();
6228+
/* If we're already down or resetting, just bail */
6229+
if (test_bit(__IGB_DOWN, &adapter->state) ||
6230+
test_bit(__IGB_RESETTING, &adapter->state)) {
6231+
rtnl_unlock();
6232+
return;
6233+
}
6234+
62276235
igb_dump(adapter);
62286236
netdev_err(adapter->netdev, "Reset adapter\n");
62296237
igb_reinit_locked(adapter);
6238+
rtnl_unlock();
62306239
}
62316240

62326241
/**

0 commit comments

Comments
 (0)