CHROMIUM: iwl7000: mvm: check for n_profiles validity in EWRD ACPI

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.

BUG=b:68723131
TEST=Create a corrupted ACPI table that claims to have
more than 3 profiles in the EWRD settings (while actually having only
3, which is the maximum.  Load the driver with KASAN enabled and check
for warnings.

Change-Id: I5f92ba940c8d211a68219510a2fa3d42504befd0
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
iwl7000-tree: d4e7c3327aa6d44ca506526975cc90123396c9c8
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
Reviewed-on: https://chromium-review.googlesource.com/1096695
Reviewed-by: Kirtika Ruchandani <kirtika@chromium.org>
Commit-Queue: Kirtika Ruchandani <kirtika@chromium.org>
Tested-by: Kirtika Ruchandani <kirtika@chromium.org>
Trybot-Ready: Kirtika Ruchandani <kirtika@chromium.org>
1 file changed