Commit 1ae68fd6 authored by Vitaly Lifshits's avatar Vitaly Lifshits Committed by Zheng Zengkai
Browse files

e1000e: add rtnl_lock() to e1000_reset_task



stable inclusion
from stable-5.10.27
commit 8ed431fec35568ad228d5be46831059e456b0337
bugzilla: 51493

--------------------------------

[ Upstream commit 21f857f0 ]

A possible race condition was found in e1000_reset_task,
after discovering a similar issue in igb driver via
commit 024a8168 ("igb: reinit_locked() should be called
with rtnl_lock").

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

Fixes: bc7f75fa ("[E1000E]: New pci-express e1000 driver (currently for ICH9 devices only)")
Suggested-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarVitaly Lifshits <vitaly.lifshits@intel.com>
Tested-by: default avatarDvora Fuxbrumer <dvorax.fuxbrumer@linux.intel.com>
Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
Signed-off-by: default avatarChen Jun <chenjun102@huawei.com>
Acked-by: default avatar&nbsp; Weilong Chen <chenweilong@huawei.com>
Signed-off-by: default avatarZheng Zengkai <zhengzengkai@huawei.com>
parent 3a045b78
Loading
Loading
Loading
Loading
+5 −1
Original line number Diff line number Diff line
@@ -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();
}

/**