Browse Source

ath10k: protect wep tx key setup

All configuration sequences should be protected
with conf_mutex to avoid concurrent/conflicting
requests.

This should make sure that wep tx key setup is not
performed while hw is restarted (at least).

Signed-off-by: Michal Kazior <michal.kazior@tieto.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
Michal Kazior 11 years ago
parent
commit
911e6c0d8d
1 changed files with 10 additions and 2 deletions
  1. 10 2
      drivers/net/wireless/ath/ath10k/mac.c

+ 10 - 2
drivers/net/wireless/ath/ath10k/mac.c

@@ -1891,8 +1891,13 @@ static void ath10k_tx_wep_key_work(struct work_struct *work)
 						wep_key_work);
 						wep_key_work);
 	int ret, keyidx = arvif->def_wep_key_newidx;
 	int ret, keyidx = arvif->def_wep_key_newidx;
 
 
+	mutex_lock(&arvif->ar->conf_mutex);
+
+	if (arvif->ar->state != ATH10K_STATE_ON)
+		goto unlock;
+
 	if (arvif->def_wep_key_idx == keyidx)
 	if (arvif->def_wep_key_idx == keyidx)
-		return;
+		goto unlock;
 
 
 	ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d set keyidx %d\n",
 	ath10k_dbg(ATH10K_DBG_MAC, "mac vdev %d set keyidx %d\n",
 		   arvif->vdev_id, keyidx);
 		   arvif->vdev_id, keyidx);
@@ -1905,10 +1910,13 @@ static void ath10k_tx_wep_key_work(struct work_struct *work)
 		ath10k_warn("failed to update wep key index for vdev %d: %d\n",
 		ath10k_warn("failed to update wep key index for vdev %d: %d\n",
 			    arvif->vdev_id,
 			    arvif->vdev_id,
 			    ret);
 			    ret);
-		return;
+		goto unlock;
 	}
 	}
 
 
 	arvif->def_wep_key_idx = keyidx;
 	arvif->def_wep_key_idx = keyidx;
+
+unlock:
+	mutex_unlock(&arvif->ar->conf_mutex);
 }
 }
 
 
 static void ath10k_tx_h_update_wep_key(struct sk_buff *skb)
 static void ath10k_tx_h_update_wep_key(struct sk_buff *skb)