lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <5b4155c9-35d4-499e-9256-148b3ed7a491@amd.com>
Date: Tue, 4 Jun 2024 10:56:40 -0500
From: Mario Limonciello <mario.limonciello@....com>
To: Anastasia Belova <abelova@...ralinux.ru>, Huang Rui <ray.huang@....com>
Cc: "Gautham R. Shenoy" <gautham.shenoy@....com>,
 Perry Yuan <perry.yuan@....com>, "Rafael J. Wysocki" <rafael@...nel.org>,
 Viresh Kumar <viresh.kumar@...aro.org>, linux-pm@...r.kernel.org,
 linux-kernel@...r.kernel.org, lvc-project@...uxtesting.org
Subject: Re: [PATCH] cpufreq: amd-pstate: add check for cpufreq_cpu_get's
 return value

On 6/3/2024 06:07, Anastasia Belova wrote:
> cpufreq_cpu_get may return NULL. To avoid NULL-dereference check it
> and return in case of error.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Anastasia Belova <abelova@...ralinux.ru>
Thank you!

Acked-by: Mario Limonciello <mario.limonciello@....com>

> ---
>   drivers/cpufreq/amd-pstate.c | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
> index 1b7e82a0ad2e..672cb6c280a4 100644
> --- a/drivers/cpufreq/amd-pstate.c
> +++ b/drivers/cpufreq/amd-pstate.c
> @@ -621,6 +621,8 @@ static void amd_pstate_adjust_perf(unsigned int cpu,
>   	unsigned long max_perf, min_perf, des_perf,
>   		      cap_perf, lowest_nonlinear_perf, max_freq;
>   	struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
> +	if (!policy)
> +		return;
>   	struct amd_cpudata *cpudata = policy->driver_data;
>   	unsigned int target_freq;
>   
> @@ -777,6 +779,8 @@ static void amd_pstate_init_prefcore(struct amd_cpudata *cpudata)
>   static void amd_pstate_update_limits(unsigned int cpu)
>   {
>   	struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
> +	if (!policy)
> +		return;
>   	struct amd_cpudata *cpudata = policy->driver_data;
>   	u32 prev_high = 0, cur_high = 0;
>   	int ret;


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ