aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAvraham Stern <avraham.stern@intel.com>2018-03-05 04:26:53 -0500
committerLuca Coelho <luciano.coelho@intel.com>2018-03-19 04:50:37 -0400
commit4a6d2e525b43eba5870ea7e360f59aa65de00705 (patch)
tree8adc89152f08edfa179d82ac98ba6fbe6782216a
parentdf65c8d1728adee2a52c30287d33da83a8c87480 (diff)
iwlwifi: mvm: fix array out of bounds reference
When starting aggregation, the code checks the status of the queue allocated to the aggregation tid, which might not yet be allocated and thus the queue index may be invalid. Fix this by reserving a new queue in case the queue id is invalid. While at it, clean up some unreachable code (a condition that is already handled earlier) and remove all the non-DQA comments since non-DQA mode is no longer supported. Fixes: cf961e16620f ("iwlwifi: mvm: support dqa-mode agg on non-shared queue") Signed-off-by: Avraham Stern <avraham.stern@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
-rw-r--r--drivers/net/wireless/intel/iwlwifi/mvm/sta.c38
1 files changed, 11 insertions, 27 deletions
diff --git a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
index fc13f6291c06..80067eb9ea05 100644
--- a/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
+++ b/drivers/net/wireless/intel/iwlwifi/mvm/sta.c
@@ -2479,28 +2479,12 @@ int iwl_mvm_sta_tx_agg_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
2479 2479
2480 /* 2480 /*
2481 * Note the possible cases: 2481 * Note the possible cases:
2482 * 1. In DQA mode with an enabled TXQ - TXQ needs to become agg'ed 2482 * 1. An enabled TXQ - TXQ needs to become agg'ed
2483 * 2. Non-DQA mode: the TXQ hasn't yet been enabled, so find a free 2483 * 2. The TXQ hasn't yet been enabled, so find a free one and mark
2484 * one and mark it as reserved 2484 * it as reserved
2485 * 3. In DQA mode, but no traffic yet on this TID: same treatment as in
2486 * non-DQA mode, since the TXQ hasn't yet been allocated
2487 * Don't support case 3 for new TX path as it is not expected to happen
2488 * and aggregation will be offloaded soon anyway
2489 */ 2485 */
2490 txq_id = mvmsta->tid_data[tid].txq_id; 2486 txq_id = mvmsta->tid_data[tid].txq_id;
2491 if (iwl_mvm_has_new_tx_api(mvm)) { 2487 if (txq_id == IWL_MVM_INVALID_QUEUE) {
2492 if (txq_id == IWL_MVM_INVALID_QUEUE) {
2493 ret = -ENXIO;
2494 goto release_locks;
2495 }
2496 } else if (unlikely(mvm->queue_info[txq_id].status ==
2497 IWL_MVM_QUEUE_SHARED)) {
2498 ret = -ENXIO;
2499 IWL_DEBUG_TX_QUEUES(mvm,
2500 "Can't start tid %d agg on shared queue!\n",
2501 tid);
2502 goto release_locks;
2503 } else if (mvm->queue_info[txq_id].status != IWL_MVM_QUEUE_READY) {
2504 txq_id = iwl_mvm_find_free_queue(mvm, mvmsta->sta_id, 2488 txq_id = iwl_mvm_find_free_queue(mvm, mvmsta->sta_id,
2505 IWL_MVM_DQA_MIN_DATA_QUEUE, 2489 IWL_MVM_DQA_MIN_DATA_QUEUE,
2506 IWL_MVM_DQA_MAX_DATA_QUEUE); 2490 IWL_MVM_DQA_MAX_DATA_QUEUE);
@@ -2509,16 +2493,16 @@ int iwl_mvm_sta_tx_agg_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
2509 IWL_ERR(mvm, "Failed to allocate agg queue\n"); 2493 IWL_ERR(mvm, "Failed to allocate agg queue\n");
2510 goto release_locks; 2494 goto release_locks;
2511 } 2495 }
2512 /*
2513 * TXQ shouldn't be in inactive mode for non-DQA, so getting
2514 * an inactive queue from iwl_mvm_find_free_queue() is
2515 * certainly a bug
2516 */
2517 WARN_ON(mvm->queue_info[txq_id].status ==
2518 IWL_MVM_QUEUE_INACTIVE);
2519 2496
2520 /* TXQ hasn't yet been enabled, so mark it only as reserved */ 2497 /* TXQ hasn't yet been enabled, so mark it only as reserved */
2521 mvm->queue_info[txq_id].status = IWL_MVM_QUEUE_RESERVED; 2498 mvm->queue_info[txq_id].status = IWL_MVM_QUEUE_RESERVED;
2499 } else if (unlikely(mvm->queue_info[txq_id].status ==
2500 IWL_MVM_QUEUE_SHARED)) {
2501 ret = -ENXIO;
2502 IWL_DEBUG_TX_QUEUES(mvm,
2503 "Can't start tid %d agg on shared queue!\n",
2504 tid);
2505 goto release_locks;
2522 } 2506 }
2523 2507
2524 spin_unlock(&mvm->queue_info_lock); 2508 spin_unlock(&mvm->queue_info_lock);