iwlegacy: more priv->mutex serialization
Check status bits with mutex taken, because when we wait for mutex
unlock, status can change. Patch should also make remaining sync
commands be send with priv->mutex taken. That will prevent execute
these commands when we are currently reset firmware, what could
possibly cause troubles.
Signed-off-by: Stanislaw Gruszka <sgruszka@redhat.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
diff --git a/drivers/net/wireless/iwlegacy/iwl3945-base.c b/drivers/net/wireless/iwlegacy/iwl3945-base.c
index cc7ebce..5bdcc36 100644
--- a/drivers/net/wireless/iwlegacy/iwl3945-base.c
+++ b/drivers/net/wireless/iwlegacy/iwl3945-base.c
@@ -2748,11 +2748,12 @@
struct iwl_priv *priv =
container_of(data, struct iwl_priv, init_alive_start.work);
- if (test_bit(STATUS_EXIT_PENDING, &priv->status))
- return;
-
mutex_lock(&priv->mutex);
+ if (test_bit(STATUS_EXIT_PENDING, &priv->status))
+ goto out;
+
iwl3945_init_alive_start(priv);
+out:
mutex_unlock(&priv->mutex);
}
@@ -2761,11 +2762,12 @@
struct iwl_priv *priv =
container_of(data, struct iwl_priv, alive_start.work);
- if (test_bit(STATUS_EXIT_PENDING, &priv->status))
- return;
-
mutex_lock(&priv->mutex);
+ if (test_bit(STATUS_EXIT_PENDING, &priv->status))
+ goto out;
+
iwl3945_alive_start(priv);
+out:
mutex_unlock(&priv->mutex);
}
@@ -2995,10 +2997,12 @@
} else {
iwl3945_down(priv);
- if (test_bit(STATUS_EXIT_PENDING, &priv->status))
- return;
-
mutex_lock(&priv->mutex);
+ if (test_bit(STATUS_EXIT_PENDING, &priv->status)) {
+ mutex_unlock(&priv->mutex);
+ return;
+ }
+
__iwl3945_up(priv);
mutex_unlock(&priv->mutex);
}
@@ -3009,11 +3013,12 @@
struct iwl_priv *priv =
container_of(data, struct iwl_priv, rx_replenish);
- if (test_bit(STATUS_EXIT_PENDING, &priv->status))
- return;
-
mutex_lock(&priv->mutex);
+ if (test_bit(STATUS_EXIT_PENDING, &priv->status))
+ goto out;
+
iwl3945_rx_replenish(priv);
+out:
mutex_unlock(&priv->mutex);
}