summaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorVitaly Lifshits <vitaly.lifshits@intel.com>2020-10-21 14:59:37 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2021-03-30 14:45:00 +0200
commit9251e3fae6a0597809c800035b0c9188d5a0165a (patch)
tree8f204dbb63d99e03abbfb4ea9440acb465a346e1 /drivers
parent812675af2b983be65195e63b8b8aab23182364df (diff)
downloadlinux-stable-9251e3fae6a0597809c800035b0c9188d5a0165a.tar.gz
linux-stable-9251e3fae6a0597809c800035b0c9188d5a0165a.tar.bz2
linux-stable-9251e3fae6a0597809c800035b0c9188d5a0165a.zip
e1000e: add rtnl_lock() to e1000_reset_task
[ Upstream commit 21f857f0321d0d0ea9b1a758bd55dc63d1cb2437 ] A possible race condition was found in e1000_reset_task, after discovering a similar issue in igb driver via commit 024a8168b749 ("igb: reinit_locked() should be called with rtnl_lock"). Added rtnl_lock() and rtnl_unlock() to avoid this. Fixes: bc7f75fa9788 ("[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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/intel/e1000e/netdev.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
index 3bd0bdbdfa0e..a8ee20ecb3ad 100644
--- a/drivers/net/ethernet/intel/e1000e/netdev.c
+++ b/drivers/net/ethernet/intel/e1000e/netdev.c
@@ -5875,15 +5875,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();
}
/**