2022-03-24 19:19:03

by Rafael J. Wysocki

[permalink] [raw]
Subject: [PATCH v1 0/2] ACPI: CPPC: acpi_cppc_processor_probe() fix and cleanup

Hi All,

This series of two patches addresses a possible out-of-bounds array access
in acpi_cppc_processor_probe() [1/2] and clean up some of it [2/2].

Please refer to the patch changelogs for details.

Thanks!




2022-03-25 19:42:54

by Rafael J. Wysocki

[permalink] [raw]
Subject: [PATCH v1 1/2] ACPI: CPPC: Avoid out of bounds access when parsing _CPC data

From: Rafael J. Wysocki <[email protected]>

If the NumEntries field in the _CPC return package is less than 2, do
not attempt to access the "Revision" element of that package, because
it may not be present then.

Fixes: 337aadff8e45 ("ACPI: Introduce CPU performance controls using CPPC")
BugLink: https://lore.kernel.org/lkml/20220322143534.GC32582@xsang-OptiPlex-9020/
Reported-by: kernel test robot <[email protected]>
Signed-off-by: Rafael J. Wysocki <[email protected]>
---
drivers/acpi/cppc_acpi.c | 5 +++++
1 file changed, 5 insertions(+)

Index: linux-pm/drivers/acpi/cppc_acpi.c
===================================================================
--- linux-pm.orig/drivers/acpi/cppc_acpi.c
+++ linux-pm/drivers/acpi/cppc_acpi.c
@@ -679,6 +679,11 @@ int acpi_cppc_processor_probe(struct acp
cpc_obj = &out_obj->package.elements[0];
if (cpc_obj->type == ACPI_TYPE_INTEGER) {
num_ent = cpc_obj->integer.value;
+ if (num_ent <= 1) {
+ pr_debug("Unexpected _CPC NumEntries value (%d) for CPU:%d\n",
+ num_ent, pr->id);
+ goto out_free;
+ }
} else {
pr_debug("Unexpected entry type(%d) for NumEntries\n",
cpc_obj->type);