Skip to content

Commit e5b6818

Browse files
rafaeljwgregkh
authored andcommitted
ACPI: CPPC: Avoid out of bounds access when parsing _CPC data
commit 40d8abf upstream. 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> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 785a533 commit e5b6818

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
@@ -719,6 +719,11 @@ int acpi_cppc_processor_probe(struct acpi_processor *pr)
719719
cpc_obj = &out_obj->package.elements[0];
720720
if (cpc_obj->type == ACPI_TYPE_INTEGER) {
721721
num_ent = cpc_obj->integer.value;
722+
if (num_ent <= 1) {
723+
pr_debug("Unexpected _CPC NumEntries value (%d) for CPU:%d\n",
724+
num_ent, pr->id);
725+
goto out_free;
726+
}
722727
} else {
723728
pr_debug("Unexpected entry type(%d) for NumEntries\n",
724729
cpc_obj->type);

0 commit comments

Comments
 (0)