Commit 2d5d50ee authored by Emmanuel Grumbach's avatar Emmanuel Grumbach Committed by Johannes Berg

iwlwifi: dvm: don't send HCMD in restart flow

There is a race between the restart flow and the workers.
The workers are cancelled after the fw is already killed
and might send HCMD when there is fw to handle them.
Simply check that there is a fw to which the HCMD can be
sent before actually sending it.

Cc: stable@vger.kernel.org
Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 4620020b
...@@ -1261,6 +1261,15 @@ int iwl_dvm_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) ...@@ -1261,6 +1261,15 @@ int iwl_dvm_send_cmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd)
return -EIO; return -EIO;
} }
/*
* This can happen upon FW ASSERT: we clear the STATUS_FW_ERROR flag
* in iwl_down but cancel the workers only later.
*/
if (!priv->ucode_loaded) {
IWL_ERR(priv, "Fw not loaded - dropping CMD: %x\n", cmd->id);
return -EIO;
}
/* /*
* Synchronous commands from this op-mode must hold * Synchronous commands from this op-mode must hold
* the mutex, this ensures we don't try to send two * the mutex, this ensures we don't try to send two
......
...@@ -367,6 +367,8 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv, ...@@ -367,6 +367,8 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv,
return -EIO; return -EIO;
} }
priv->ucode_loaded = true;
if (ucode_type != IWL_UCODE_WOWLAN) { if (ucode_type != IWL_UCODE_WOWLAN) {
/* delay a bit to give rfkill time to run */ /* delay a bit to give rfkill time to run */
msleep(5); msleep(5);
...@@ -380,8 +382,6 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv, ...@@ -380,8 +382,6 @@ int iwl_load_ucode_wait_alive(struct iwl_priv *priv,
return ret; return ret;
} }
priv->ucode_loaded = true;
return 0; return 0;
} }
......
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