Skip to content

Commit 6542979

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 68a7894 commit 6542979

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
@@ -724,22 +724,25 @@ int iwl_acpi_get_wgds_table(struct iwl_fw_runtime *fwrt)
724724
entry = &wifi_pkg->package.elements[entry_idx];
725725
entry_idx++;
726726
if (entry->type != ACPI_TYPE_INTEGER ||
727-
entry->integer.value > num_profiles) {
727+
entry->integer.value > num_profiles ||
728+
entry->integer.value <
729+
rev_data[idx].min_profiles) {
728730
ret = -EINVAL;
729731
goto out_free;
730732
}
731-
num_profiles = entry->integer.value;
732733

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

0 commit comments

Comments
 (0)