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

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 <>
iwl7000-tree: d4e7c3327aa6d44ca506526975cc90123396c9c8
Signed-off-by: Luca Coelho <>
Reviewed-by: Kirtika Ruchandani <>
Commit-Queue: Kirtika Ruchandani <>
Tested-by: Kirtika Ruchandani <>
Trybot-Ready: Kirtika Ruchandani <>
1 file changed