]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
wifi: iwlwifi: mvm: fix potential out-of-bounds read in iwl_mvm_nd_match_info_handler()
authorAlexey Velichayshiy <a.velichayshiy@ispras.ru>
Sat, 7 Feb 2026 15:03:22 +0000 (18:03 +0300)
committerJohannes Berg <johannes.berg@intel.com>
Tue, 24 Mar 2026 15:03:48 +0000 (16:03 +0100)
The memcpy function assumes the dynamic array notif->matches is at least
as large as the number of bytes to copy. Otherwise, results->matches may
contain unwanted data. To guarantee safety, extend the validation in one
of the checks to ensure sufficient packet length.

Found by Linux Verification Center (linuxtesting.org) with SVACE.

Cc: stable@vger.kernel.org
Fixes: 5ac54afd4d97 ("wifi: iwlwifi: mvm: Add handling for scan offload match info notification")
Signed-off-by: Alexey Velichayshiy <a.velichayshiy@ispras.ru>
Link: https://patch.msgid.link/20260207150335.1013646-1-a.velichayshiy@ispras.ru
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
drivers/net/wireless/intel/iwlwifi/mvm/d3.c

index a19f9d2e9346355825513dd8c367803861aa9d7f..9a74f60c91850f4283db4d310e5ebf39d7cabb5d 100644 (file)
@@ -2807,7 +2807,7 @@ static void iwl_mvm_nd_match_info_handler(struct iwl_mvm *mvm,
        if (IS_ERR_OR_NULL(vif))
                return;
 
-       if (len < sizeof(struct iwl_scan_offload_match_info)) {
+       if (len < sizeof(struct iwl_scan_offload_match_info) + matches_len) {
                IWL_ERR(mvm, "Invalid scan match info notification\n");
                return;
        }