Skip to content

Commit

Permalink
e1000e: add rtnl_lock() to e1000_reset_task
Browse files Browse the repository at this point in the history
A possible race condition was found in e1000_reset_task,
after discovering a similar issue in igb driver via
commit 024a816 ("igb: reinit_locked() should be called
with rtnl_lock").

Added rtnl_lock() and rtnl_unlock() to avoid this.

Fixes: bc7f75f ("[E1000E]: New pci-express e1000 driver (currently for ICH9 devices only)")
Suggested-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Vitaly Lifshits <vitaly.lifshits@intel.com>
Tested-by: Dvora Fuxbrumer <dvorax.fuxbrumer@linux.intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
  • Loading branch information
Vitaly Lifshits authored and Tony Nguyen committed Mar 11, 2021
1 parent fc9e502 commit 21f857f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion drivers/net/ethernet/intel/e1000e/netdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -5974,15 +5974,19 @@ static void e1000_reset_task(struct work_struct *work)
struct e1000_adapter *adapter;
adapter = container_of(work, struct e1000_adapter, reset_task);

rtnl_lock();
/* don't run the task if already down */
if (test_bit(__E1000_DOWN, &adapter->state))
if (test_bit(__E1000_DOWN, &adapter->state)) {
rtnl_unlock();
return;
}

if (!(adapter->flags & FLAG_RESTART_NOW)) {
e1000e_dump(adapter);
e_err("Reset adapter unexpectedly\n");
}
e1000e_reinit_locked(adapter);
rtnl_unlock();
}

/**
Expand Down

0 comments on commit 21f857f

Please sign in to comment.