mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-05 18:41:58 +09:00
iwlwifi: mvm: check for n_profiles validity in EWRD ACPI
[ Upstream commit2e1976bb75] When reading the profiles from the EWRD table in ACPI, we loop over the data and set it into our internal table. We use the number of profiles specified in ACPI without checking its validity, so if the ACPI table is corrupted and the number is larger than our array size, we will try to make an out-of-bounds access. Fix this by making sure the value specified in the ACPI table is valid. Fixes:6996490501("iwlwifi: mvm: add support for EWRD (Dynamic SAR) ACPI table") Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Signed-off-by: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
b325d5508a
commit
a2abae525e
@@ -704,8 +704,12 @@ static int iwl_mvm_sar_get_ewrd_table(struct iwl_mvm *mvm)
|
||||
enabled = !!(wifi_pkg->package.elements[1].integer.value);
|
||||
n_profiles = wifi_pkg->package.elements[2].integer.value;
|
||||
|
||||
/* in case of BIOS bug */
|
||||
if (n_profiles <= 0) {
|
||||
/*
|
||||
* Check the validity of n_profiles. The EWRD profiles start
|
||||
* from index 1, so the maximum value allowed here is
|
||||
* ACPI_SAR_PROFILES_NUM - 1.
|
||||
*/
|
||||
if (n_profiles <= 0 || n_profiles >= ACPI_SAR_PROFILE_NUM) {
|
||||
ret = -EINVAL;
|
||||
goto out_free;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user