From: "Rafael J. Wysocki" rafael.j.wysocki@intel.com
mainline inclusion from mainline-v5.17-rc1 commit 5f51c7ce1dc36565296b3ef342585f70ec72a2a9 category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9QRD6 CVE: CVE-2024-35995
Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?i...
--------------------------------
The code as currently implemented does not work on big endian systems, so fix it up.
Fixes: a2c8f92bea5f ("ACPI: CPPC: Implement support for SystemIO registers") Reported-by: Dan Carpenter dan.carpenter@oracle.com Suggested-by: Dan Carpenter dan.carpenter@oracle.com Link: https://lore.kernel.org/linux-acpi/20220111092928.GA24968@kili/ Signed-off-by: Rafael J. Wysocki rafael.j.wysocki@intel.com Acked-by: Huang Rui ray.huang@amd.com Signed-off-by: liwei liwei728@huawei.com --- drivers/acpi/cppc_acpi.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/acpi/cppc_acpi.c b/drivers/acpi/cppc_acpi.c index 7e510e9b8842..d5ca79446607 100644 --- a/drivers/acpi/cppc_acpi.c +++ b/drivers/acpi/cppc_acpi.c @@ -1085,16 +1085,18 @@ static int cpc_read(int cpu, struct cpc_register_resource *reg_res, u64 *val)
if (reg->space_id == ACPI_ADR_SPACE_SYSTEM_IO) { u32 width = 8 << (reg->access_width - 1); + u32 val_u32; acpi_status status;
status = acpi_os_read_port((acpi_io_address)reg->address, - (u32 *)val, width); + &val_u32, width); if (ACPI_FAILURE(status)) { pr_debug("Error: Failed to read SystemIO port %llx\n", reg->address); return -EFAULT; }
+ *val = val_u32; return 0; } else if (reg->space_id == ACPI_ADR_SPACE_PLATFORM_COMM && pcc_ss_id >= 0) vaddr = GET_PCC_VADDR(reg->address, pcc_ss_id);