Commit 3ee22f07 authored by Anjaneyulu's avatar Anjaneyulu Committed by Johannes Berg

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: 97f8a3d1 ("iwlwifi: ACPI: support revision 3 WGDS tables")
Signed-off-by: default avatarAnjaneyulu <pagadala.yesu.anjaneyulu@intel.com>
Signed-off-by: default avatarMiri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20240825191257.cc71dfc67ec3.Ic27ee15ac6128b275c210b6de88f2145bd83ca7b@changeid
[edit commit message]
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent cd6f46c2
...@@ -725,22 +725,25 @@ int iwl_acpi_get_wgds_table(struct iwl_fw_runtime *fwrt) ...@@ -725,22 +725,25 @@ int iwl_acpi_get_wgds_table(struct iwl_fw_runtime *fwrt)
entry = &wifi_pkg->package.elements[entry_idx]; entry = &wifi_pkg->package.elements[entry_idx];
entry_idx++; entry_idx++;
if (entry->type != ACPI_TYPE_INTEGER || if (entry->type != ACPI_TYPE_INTEGER ||
entry->integer.value > num_profiles) { entry->integer.value > num_profiles ||
entry->integer.value <
rev_data[idx].min_profiles) {
ret = -EINVAL; ret = -EINVAL;
goto out_free; goto out_free;
} }
num_profiles = entry->integer.value;
/* /*
* this also validates >= min_profiles since we * Check to see if we received package count
* otherwise wouldn't have gotten the data when * same as max # of profiles
* looking up in ACPI
*/ */
if (wifi_pkg->package.count != if (wifi_pkg->package.count !=
hdr_size + profile_size * num_profiles) { hdr_size + profile_size * num_profiles) {
ret = -EINVAL; ret = -EINVAL;
goto out_free; goto out_free;
} }
/* Number of valid profiles */
num_profiles = entry->integer.value;
} }
goto read_table; goto read_table;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment