Skip to content

Commit 3ee22f0

Browse files
panjaneyjmberg-intel
authored andcommitted
wifi: iwlwifi: fw: fix wgds rev 3 exact size
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]>
1 parent cd6f46c commit 3ee22f0

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

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -725,22 +725,25 @@ int iwl_acpi_get_wgds_table(struct iwl_fw_runtime *fwrt)
725725
entry = &wifi_pkg->package.elements[entry_idx];
726726
entry_idx++;
727727
if (entry->type != ACPI_TYPE_INTEGER ||
728-
entry->integer.value > num_profiles) {
728+
entry->integer.value > num_profiles ||
729+
entry->integer.value <
730+
rev_data[idx].min_profiles) {
729731
ret = -EINVAL;
730732
goto out_free;
731733
}
732-
num_profiles = entry->integer.value;
733734

734735
/*
735-
* this also validates >= min_profiles since we
736-
* otherwise wouldn't have gotten the data when
737-
* looking up in ACPI
736+
* Check to see if we received package count
737+
* same as max # of profiles
738738
*/
739739
if (wifi_pkg->package.count !=
740740
hdr_size + profile_size * num_profiles) {
741741
ret = -EINVAL;
742742
goto out_free;
743743
}
744+
745+
/* Number of valid profiles */
746+
num_profiles = entry->integer.value;
744747
}
745748
goto read_table;
746749
}

0 commit comments

Comments
 (0)