Commit 6cce2ada authored by Thomas Falcon's avatar Thomas Falcon Committed by Greg Kroah-Hartman

ibmvnic: Do not process reset during or after device removal

[ Upstream commit 36f1031c ]

Currently, the ibmvnic driver will not schedule device resets
if the device is being removed, but does not check the device
state before the reset is actually processed. This leads to a race
where a reset is scheduled with a valid device state but is
processed after the driver has been removed, resulting in an oops.

Fix this by checking the device state before processing a queued
reset event.
Reported-by: default avatarAbdul Haleem <abdhalee@linux.vnet.ibm.com>
Tested-by: default avatarAbdul Haleem <abdhalee@linux.vnet.ibm.com>
Signed-off-by: default avatarThomas Falcon <tlfalcon@linux.ibm.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 080ca754
...@@ -1998,6 +1998,10 @@ static void __ibmvnic_reset(struct work_struct *work) ...@@ -1998,6 +1998,10 @@ static void __ibmvnic_reset(struct work_struct *work)
rwi = get_next_rwi(adapter); rwi = get_next_rwi(adapter);
while (rwi) { while (rwi) {
if (adapter->state == VNIC_REMOVING ||
adapter->state == VNIC_REMOVED)
goto out;
if (adapter->force_reset_recovery) { if (adapter->force_reset_recovery) {
adapter->force_reset_recovery = false; adapter->force_reset_recovery = false;
rc = do_hard_reset(adapter, rwi, reset_state); rc = do_hard_reset(adapter, rwi, reset_state);
...@@ -2022,7 +2026,7 @@ static void __ibmvnic_reset(struct work_struct *work) ...@@ -2022,7 +2026,7 @@ static void __ibmvnic_reset(struct work_struct *work)
netdev_dbg(adapter->netdev, "Reset failed\n"); netdev_dbg(adapter->netdev, "Reset failed\n");
free_all_rwi(adapter); free_all_rwi(adapter);
} }
out:
adapter->resetting = false; adapter->resetting = false;
if (we_lock_rtnl) if (we_lock_rtnl)
rtnl_unlock(); rtnl_unlock();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment