Commit 7d6446db authored by Emil Tantilov's avatar Emil Tantilov Committed by Jeff Kirsher

ixgbevf: fix possible race in the reset subtask

Extend the RTNL lock in ixgbevf_reset_subtask() to protect the state bits
check in addition to the call to ixgbevf_reinit_locked().

This is to make sure that we get the most up-to-date values for the bits
and avoid a possible race when going down.
Suggested-by: default avatarZhiping du <zhipingdu@tencent.com>
Signed-off-by: default avatarEmil Tantilov <emil.s.tantilov@intel.com>
Tested-by: default avatarAndrew Bowers <andrewx.bowers@intel.com>
Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
parent 4be87727
...@@ -3141,15 +3141,17 @@ static void ixgbevf_reset_subtask(struct ixgbevf_adapter *adapter) ...@@ -3141,15 +3141,17 @@ static void ixgbevf_reset_subtask(struct ixgbevf_adapter *adapter)
if (!test_and_clear_bit(__IXGBEVF_RESET_REQUESTED, &adapter->state)) if (!test_and_clear_bit(__IXGBEVF_RESET_REQUESTED, &adapter->state))
return; return;
rtnl_lock();
/* If we're already down or resetting, just bail */ /* If we're already down or resetting, just bail */
if (test_bit(__IXGBEVF_DOWN, &adapter->state) || if (test_bit(__IXGBEVF_DOWN, &adapter->state) ||
test_bit(__IXGBEVF_REMOVING, &adapter->state) || test_bit(__IXGBEVF_REMOVING, &adapter->state) ||
test_bit(__IXGBEVF_RESETTING, &adapter->state)) test_bit(__IXGBEVF_RESETTING, &adapter->state)) {
rtnl_unlock();
return; return;
}
adapter->tx_timeout_count++; adapter->tx_timeout_count++;
rtnl_lock();
ixgbevf_reinit_locked(adapter); ixgbevf_reinit_locked(adapter);
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