[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAJZ5v0gaCgqJy59YEp3KPOGO9W99rLFUDJ1Bw5iGLokA-U5R_Q@mail.gmail.com>
Date: Thu, 18 Nov 2021 14:14:54 +0100
From: "Rafael J. Wysocki" <rafael@...nel.org>
To: Kai-Heng Feng <kai.heng.feng@...onical.com>
Cc: Srinivas Pandruvada <srinivas.pandruvada@...ux.intel.com>,
Len Brown <lenb@...nel.org>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Viresh Kumar <viresh.kumar@...aro.org>,
"open list:INTEL PSTATE DRIVER" <linux-pm@...r.kernel.org>,
open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] cpufreq: intel_pstate: Avoid using CPPC when ACPI CPC is
not valid
On Thu, Nov 18, 2021 at 1:46 PM Kai-Heng Feng
<kai.heng.feng@...onical.com> wrote:
>
> If ACPI CPC is not valid, dereference cpc_desc in cppc_get_perf() causes
> a NULL pointer dereference. So avoid using CPPC for that scenario.
>
> Fixes: 46573fd6369f ("cpufreq: intel_pstate: hybrid: Rework HWP calibration")
> Signed-off-by: Kai-Heng Feng <kai.heng.feng@...onical.com>
The bug is real, but it is not in intel_pstate.
cppc_get_perf() should return an error in that case.
Let me fix this.
> ---
> drivers/cpufreq/intel_pstate.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c
> index 815df3daae9df..24c7d705b99b6 100644
> --- a/drivers/cpufreq/intel_pstate.c
> +++ b/drivers/cpufreq/intel_pstate.c
> @@ -3369,7 +3369,7 @@ static int __init intel_pstate_init(void)
> if (!default_driver)
> default_driver = &intel_pstate;
>
> - if (boot_cpu_has(X86_FEATURE_HYBRID_CPU))
> + if (boot_cpu_has(X86_FEATURE_HYBRID_CPU) && acpi_cpc_valid())
> intel_pstate_cppc_set_cpu_scaling();
>
> goto hwp_cpu_matched;
> --
> 2.32.0
>
Powered by blists - more mailing lists