iwlwifi: mvm: validate tid and sta_id in ba_notif
authorEyal Shapira <eyal@wizery.com>
Fri, 16 Jan 2015 09:09:30 +0000 (11:09 +0200)
committerEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Tue, 20 Jan 2015 06:47:16 +0000 (08:47 +0200)
These are coming from the FW and are used to access arrays.
Bad values can cause an out of bounds access so discard
such ba_notifs and warn.

CC: <stable@vger.kernel.org> [3.10+]
Signed-off-by: Eyal Shapira <eyalx.shapira@intel.com>
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
drivers/net/wireless/iwlwifi/mvm/tx.c

index c59d07567d9041688401c0345376e9dc52de3157..650a5f0b94c753199bd70ab857e0363d73c07f8a 100644 (file)
@@ -930,6 +930,11 @@ int iwl_mvm_rx_ba_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb,
        sta_id = ba_notif->sta_id;
        tid = ba_notif->tid;
 
+       if (WARN_ONCE(sta_id >= IWL_MVM_STATION_COUNT ||
+                     tid >= IWL_MAX_TID_COUNT,
+                     "sta_id %d tid %d", sta_id, tid))
+               return 0;
+
        rcu_read_lock();
 
        sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]);