]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: iwlwifi: mvm: check the validity of noa_len
authorMiri Korenblit <miriam.rachel.korenblit@intel.com>
Mon, 10 Nov 2025 13:02:15 +0000 (15:02 +0200)
committerMiri Korenblit <miriam.rachel.korenblit@intel.com>
Wed, 21 Jan 2026 12:23:01 +0000 (14:23 +0200)
Validate iwl_probe_resp_data_notif::noa_attr::len_low since we are using
its value to determine the noa_len, which is later used for the NoA
attribute.

Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20251110150012.99b663d9b424.I206fd54c990ca9e1160b9b94fa8be44e67bcc1b9@changeid
drivers/net/wireless/intel/iwlwifi/mvm/mac-ctxt.c

index 867807abde6643f4b988d45d0075436fb564fd96..49ffc4ecee855ab22c6d2de40e1600a3dc4fe7fc 100644 (file)
@@ -1761,6 +1761,20 @@ void iwl_mvm_probe_resp_data_notif(struct iwl_mvm *mvm,
 
        mvmvif = iwl_mvm_vif_from_mac80211(vif);
 
+       /*
+        * len_low should be 2 + n*13 (where n is the number of descriptors.
+        * 13 is the size of a NoA descriptor). We can have either one or two
+        * descriptors.
+        */
+       if (IWL_FW_CHECK(mvm, notif->noa_active &&
+                        notif->noa_attr.len_low != 2 +
+                        sizeof(struct ieee80211_p2p_noa_desc) &&
+                        notif->noa_attr.len_low != 2 +
+                        sizeof(struct ieee80211_p2p_noa_desc) * 2,
+                        "Invalid noa_attr.len_low (%d)\n",
+                        notif->noa_attr.len_low))
+               return;
+
        new_data = kzalloc(sizeof(*new_data), GFP_KERNEL);
        if (!new_data)
                return;