Skip to content

Commit 1a525d9

Browse files
panjaneygregkh
authored andcommitted
wifi: iwlwifi: fw: fix wgds rev 3 exact size
[ Upstream commit 3ee22f0 ] Check size of WGDS revision 3 is equal to 8 entries size with some header, but doesn't depend on the number of used entries. Check that used entries are between min and max but allow more to be present than are used to fix operation with some BIOSes that have such data. Fixes: 97f8a3d ("iwlwifi: ACPI: support revision 3 WGDS tables") Signed-off-by: Anjaneyulu <[email protected]> Signed-off-by: Miri Korenblit <[email protected]> Link: https://patch.msgid.link/20240825191257.cc71dfc67ec3.Ic27ee15ac6128b275c210b6de88f2145bd83ca7b@changeid [edit commit message] Signed-off-by: Johannes Berg <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 8e51088 commit 1a525d9

File tree

1 file changed

+8
-5
lines changed
  • drivers/net/wireless/intel/iwlwifi/fw

1 file changed

+8
-5
lines changed

drivers/net/wireless/intel/iwlwifi/fw/acpi.c

+8-5
Original file line numberDiff line numberDiff line change
@@ -867,22 +867,25 @@ int iwl_sar_get_wgds_table(struct iwl_fw_runtime *fwrt)
867867
entry = &wifi_pkg->package.elements[entry_idx];
868868
entry_idx++;
869869
if (entry->type != ACPI_TYPE_INTEGER ||
870-
entry->integer.value > num_profiles) {
870+
entry->integer.value > num_profiles ||
871+
entry->integer.value <
872+
rev_data[idx].min_profiles) {
871873
ret = -EINVAL;
872874
goto out_free;
873875
}
874-
num_profiles = entry->integer.value;
875876

876877
/*
877-
* this also validates >= min_profiles since we
878-
* otherwise wouldn't have gotten the data when
879-
* looking up in ACPI
878+
* Check to see if we received package count
879+
* same as max # of profiles
880880
*/
881881
if (wifi_pkg->package.count !=
882882
hdr_size + profile_size * num_profiles) {
883883
ret = -EINVAL;
884884
goto out_free;
885885
}
886+
887+
/* Number of valid profiles */
888+
num_profiles = entry->integer.value;
886889
}
887890
goto read_table;
888891
}

0 commit comments

Comments
 (0)