Skip to content

Commit 40d8abf

Browse files
committed
ACPI: CPPC: Avoid out of bounds access when parsing _CPC data
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: 337aadf ("ACPI: Introduce CPU performance controls using CPPC") BugLink: https://lore.kernel.org/lkml/20220322143534.GC32582@xsang-OptiPlex-9020/ Reported-by: kernel test robot <oliver.sang@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Huang Rui <ray.huang@amd.com>
1 parent 242ba66 commit 40d8abf

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

drivers/acpi/cppc_acpi.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -679,6 +679,11 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
679679
cpc_obj = &out_obj->package.elements[0];
680680
if (cpc_obj->type == ACPI_TYPE_INTEGER) {
681681
num_ent = cpc_obj->integer.value;
682+
if (num_ent <= 1) {
683+
pr_debug("Unexpected _CPC NumEntries value (%d) for CPU:%d\n",
684+
num_ent, pr->id);
685+
goto out_free;
686+
}
682687
} else {
683688
pr_debug("Unexpected entry type(%d) for NumEntries\n",
684689
cpc_obj->type);

0 commit comments

Comments
 (0)