Takashi Iwai c436a6
From 06bc6f6ed4ae0246a5e52094d1be90906a1361c7 Mon Sep 17 00:00:00 2001
Takashi Iwai c436a6
From: Johannes Berg <johannes.berg@intel.com>
Takashi Iwai c436a6
Date: Wed, 4 Jul 2018 23:12:33 +0200
Takashi Iwai c436a6
Subject: [PATCH] iwlwifi: mvm: synchronize TID queue removal
Takashi Iwai c436a6
Git-commit: 06bc6f6ed4ae0246a5e52094d1be90906a1361c7
Takashi Iwai c436a6
Patch-mainline: v5.0-rc1
Takashi Iwai c436a6
References: bsc#1051510
Takashi Iwai c436a6
Takashi Iwai c436a6
When we mark a TID as no longer having a queue, there's no
Takashi Iwai c436a6
guarantee the TX path isn't using this txq_id right now,
Takashi Iwai c436a6
having accessed it just before we reset the value. To fix
Takashi Iwai c436a6
this, add synchronize_net() when we change the TIDs from
Takashi Iwai c436a6
having a queue to not having one, so that we can then be
Takashi Iwai c436a6
sure that the TX path is no longer accessing that queue.
Takashi Iwai c436a6
Takashi Iwai c436a6
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Takashi Iwai c436a6
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Takashi Iwai c436a6
Acked-by: Takashi Iwai <tiwai@suse.de>
Takashi Iwai c436a6
Takashi Iwai c436a6
---
Takashi Iwai c436a6
 drivers/net/wireless/intel/iwlwifi/mvm/sta.c | 10 ++++++++++
Takashi Iwai c436a6
 1 file changed, 10 insertions(+)
Takashi Iwai c436a6
Takashi Iwai c436a6
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
Takashi Iwai c436a6
index 1887d2b9f185..c2b7bb5d107c 100644
Takashi Iwai c436a6
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
Takashi Iwai c436a6
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
Takashi Iwai c436a6
@@ -545,6 +545,16 @@ static int iwl_mvm_remove_sta_queue_marking(struct iwl_mvm *mvm, int queue)
Takashi Iwai c436a6
 
Takashi Iwai c436a6
 	rcu_read_unlock();
Takashi Iwai c436a6
 
Takashi Iwai c436a6
+	/*
Takashi Iwai c436a6
+	 * The TX path may have been using this TXQ_ID from the tid_data,
Takashi Iwai c436a6
+	 * so make sure it's no longer running so that we can safely reuse
Takashi Iwai c436a6
+	 * this TXQ later. We've set all the TIDs to IWL_MVM_INVALID_QUEUE
Takashi Iwai c436a6
+	 * above, but nothing guarantees we've stopped using them. Thus,
Takashi Iwai c436a6
+	 * without this, we could get to iwl_mvm_disable_txq() and remove
Takashi Iwai c436a6
+	 * the queue while still sending frames to it.
Takashi Iwai c436a6
+	 */
Takashi Iwai c436a6
+	synchronize_net();
Takashi Iwai c436a6
+
Takashi Iwai c436a6
 	return disable_agg_tids;
Takashi Iwai c436a6
 }
Takashi Iwai c436a6
 
Takashi Iwai c436a6
-- 
Takashi Iwai c436a6
2.16.4
Takashi Iwai c436a6