[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <2611837.mvXUDI8C0e@kreacher>
Date: Thu, 18 Nov 2021 14:33:19 +0100
From: "Rafael J. Wysocki" <rjw@...ysocki.net>
To: Linux ACPI <linux-acpi@...r.kernel.org>
Cc: LKML <linux-kernel@...r.kernel.org>,
Linux PM <linux-pm@...r.kernel.org>,
Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
Kai-Heng Feng <kai.heng.feng@...onical.com>
Subject: [PATCH] ACPI: CPPC: Add NULL pointer check to cppc_get_perf()
From: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
Check cpc_desc against NULL in cppc_get_perf(), so it doesn't crash
down the road if cpc_desc is NULL.
Fixes: 0654cf05d17b ("ACPI: CPPC: Introduce cppc_get_nominal_perf()")
Reported-by: Kai-Heng Feng <kai.heng.feng@...onical.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@...el.com>
Cc: 5.15+ <stable@...r.kernel.org> # 5.15+
---
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
@@ -1000,6 +1000,11 @@ static int cppc_get_perf(int cpunum, enu
struct cpc_desc *cpc_desc = per_cpu(cpc_desc_ptr, cpunum);
struct cpc_register_resource *reg = &cpc_desc->cpc_regs[reg_idx];
+ if (!cpc_desc) {
+ pr_debug("No CPC descriptor for CPU:%d\n", cpunum);
+ return -ENODEV;
+ }
+
if (CPC_IN_PCC(reg)) {
int pcc_ss_id = per_cpu(cpu_pcc_subspace_idx, cpunum);
struct cppc_pcc_data *pcc_ss_data = NULL;
Powered by blists - more mailing lists