mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-28 11:18:45 +07:00
iwlwifi: mvm: avoid possible access out of array.
The value in txq_id can be out of array scope,
validate it before accessing the array.
Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com>
Fixes: cf961e1662
("iwlwifi: mvm: support dqa-mode agg on non-shared queue")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
This commit is contained in:
parent
c1f3344297
commit
b0d795a9ae
@ -2702,7 +2702,7 @@ int iwl_mvm_sta_tx_agg_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
|
||||
struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
|
||||
struct iwl_mvm_tid_data *tid_data;
|
||||
u16 normalized_ssn;
|
||||
int txq_id;
|
||||
u16 txq_id;
|
||||
int ret;
|
||||
|
||||
if (WARN_ON_ONCE(tid >= IWL_MAX_TID_COUNT))
|
||||
@ -2744,17 +2744,24 @@ int iwl_mvm_sta_tx_agg_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
|
||||
*/
|
||||
txq_id = mvmsta->tid_data[tid].txq_id;
|
||||
if (txq_id == IWL_MVM_INVALID_QUEUE) {
|
||||
txq_id = iwl_mvm_find_free_queue(mvm, mvmsta->sta_id,
|
||||
IWL_MVM_DQA_MIN_DATA_QUEUE,
|
||||
IWL_MVM_DQA_MAX_DATA_QUEUE);
|
||||
if (txq_id < 0) {
|
||||
ret = txq_id;
|
||||
ret = iwl_mvm_find_free_queue(mvm, mvmsta->sta_id,
|
||||
IWL_MVM_DQA_MIN_DATA_QUEUE,
|
||||
IWL_MVM_DQA_MAX_DATA_QUEUE);
|
||||
if (ret < 0) {
|
||||
IWL_ERR(mvm, "Failed to allocate agg queue\n");
|
||||
goto out;
|
||||
}
|
||||
|
||||
txq_id = ret;
|
||||
|
||||
/* TXQ hasn't yet been enabled, so mark it only as reserved */
|
||||
mvm->queue_info[txq_id].status = IWL_MVM_QUEUE_RESERVED;
|
||||
} else if (WARN_ON(txq_id >= IWL_MAX_HW_QUEUES)) {
|
||||
ret = -ENXIO;
|
||||
IWL_ERR(mvm, "tid_id %d out of range (0, %d)!\n",
|
||||
tid, IWL_MAX_HW_QUEUES - 1);
|
||||
goto out;
|
||||
|
||||
} else if (unlikely(mvm->queue_info[txq_id].status ==
|
||||
IWL_MVM_QUEUE_SHARED)) {
|
||||
ret = -ENXIO;
|
||||
|
Loading…
Reference in New Issue
Block a user