iwlwifi: mvm: check for n_profiles validity in EWRD ACPI
authorLuca Coelho <luciano.coelho@intel.com>
Mon, 11 Jun 2018 08:15:17 +0000 (11:15 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 13 Nov 2018 19:08:23 +0000 (11:08 -0800)
commita2abae525e2d4c9ff62e15b8da29459e7e23271e
tree2c5b9b0126aadf3c79e142777548adea02500c3a
parentb325d5508a901dd4ede320ac2832588544558f83
iwlwifi: mvm: check for n_profiles validity in EWRD ACPI

[ Upstream commit 2e1976bb75263fbad918e82184b16a23bd721546 ]

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: 6996490501ed ("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>
drivers/net/wireless/intel/iwlwifi/mvm/fw.c