public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* Re: [PATCH 6.1.y] cpufreq: amd-pstate: add check for cpufreq_cpu_get's return value
  2024-12-06 10:41 [PATCH 6.1.y] cpufreq: amd-pstate: add check for cpufreq_cpu_get's return value jianqi.ren.cn
@ 2024-12-06 10:05 ` Greg KH
  2024-12-06 17:11 ` Sasha Levin
  2024-12-11  8:14 ` Greg KH
  2 siblings, 0 replies; 11+ messages in thread
From: Greg KH @ 2024-12-06 10:05 UTC (permalink / raw)
  To: jianqi.ren.cn; +Cc: abelova, stable

On Fri, Dec 06, 2024 at 06:41:15PM +0800, jianqi.ren.cn@windriver.com wrote:
> From: Anastasia Belova <abelova@astralinux.ru>
> 
> [ Upstream commit 5493f9714e4cdaf0ee7cec15899a231400cb1a9f ]
> 
> 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@astralinux.ru>
> Reviewed-by: Perry Yuan <perry.yuan@amd.com>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> Signed-off-by: Jianqi Ren <jianqi.ren.cn@windriver.com>
> ---
>  drivers/cpufreq/amd-pstate.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)

Any reason you are not cc:ing all of the people involved in these
patches when backporting them?

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 6.1.y] cpufreq: amd-pstate: add check for cpufreq_cpu_get's return value
@ 2024-12-06 10:41 jianqi.ren.cn
  2024-12-06 10:05 ` Greg KH
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: jianqi.ren.cn @ 2024-12-06 10:41 UTC (permalink / raw)
  To: abelova, gregkh; +Cc: stable

From: Anastasia Belova <abelova@astralinux.ru>

[ Upstream commit 5493f9714e4cdaf0ee7cec15899a231400cb1a9f ]

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@astralinux.ru>
Reviewed-by: Perry Yuan <perry.yuan@amd.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Jianqi Ren <jianqi.ren.cn@windriver.com>
---
 drivers/cpufreq/amd-pstate.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index 90dcf26f0973..106aef210003 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -309,9 +309,14 @@ 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);
-	struct amd_cpudata *cpudata = policy->driver_data;
+	struct amd_cpudata *cpudata;
 	unsigned int target_freq;
 
+	if (!policy)
+		return;
+
+	cpudata = policy->driver_data;
+
 	cap_perf = READ_ONCE(cpudata->highest_perf);
 	lowest_nonlinear_perf = READ_ONCE(cpudata->lowest_nonlinear_perf);
 	max_freq = READ_ONCE(cpudata->max_freq);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 6.1.y] cpufreq: amd-pstate: add check for cpufreq_cpu_get's return value
  2024-12-06 10:41 [PATCH 6.1.y] cpufreq: amd-pstate: add check for cpufreq_cpu_get's return value jianqi.ren.cn
  2024-12-06 10:05 ` Greg KH
@ 2024-12-06 17:11 ` Sasha Levin
  2024-12-11  8:14 ` Greg KH
  2 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2024-12-06 17:11 UTC (permalink / raw)
  To: stable; +Cc: jianqi.ren.cn, Sasha Levin

[ Sasha's backport helper bot ]

Hi,

The upstream commit SHA1 provided is correct: 5493f9714e4cdaf0ee7cec15899a231400cb1a9f

WARNING: Author mismatch between patch and upstream commit:
Backport author: <jianqi.ren.cn@windriver.com>
Commit author: Anastasia Belova <abelova@astralinux.ru>


Status in newer kernel trees:
6.12.y | Present (exact SHA1)
6.6.y | Not found
6.1.y | Not found

Note: The patch differs from the upstream commit:
---
1:  5493f9714e4cd < -:  ------------- cpufreq: amd-pstate: add check for cpufreq_cpu_get's return value
-:  ------------- > 1:  354e938883a4e cpufreq: amd-pstate: add check for cpufreq_cpu_get's return value
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.1.y        |  Success    |  Success   |

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 6.1.y] cpufreq: amd-pstate: add check for cpufreq_cpu_get's return value
@ 2024-12-09  4:19 jianqi.ren.cn
  2024-12-09 10:07 ` Anastasia Belova
  2024-12-09 14:35 ` Sasha Levin
  0 siblings, 2 replies; 11+ messages in thread
From: jianqi.ren.cn @ 2024-12-09  4:19 UTC (permalink / raw)
  To: abelova, gregkh
  Cc: stable, ray.huang, rafael, viresh.kumar, linux-pm, linux-kernel

From: Anastasia Belova <abelova@astralinux.ru>

[ Upstream commit 5493f9714e4cdaf0ee7cec15899a231400cb1a9f ]

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@astralinux.ru>
Reviewed-by: Perry Yuan <perry.yuan@amd.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Jianqi Ren <jianqi.ren.cn@windriver.com>
---
 drivers/cpufreq/amd-pstate.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index 90dcf26f0973..106aef210003 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -309,9 +309,14 @@ 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);
-	struct amd_cpudata *cpudata = policy->driver_data;
+	struct amd_cpudata *cpudata;
 	unsigned int target_freq;
 
+	if (!policy)
+		return;
+
+	cpudata = policy->driver_data;
+
 	cap_perf = READ_ONCE(cpudata->highest_perf);
 	lowest_nonlinear_perf = READ_ONCE(cpudata->lowest_nonlinear_perf);
 	max_freq = READ_ONCE(cpudata->max_freq);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 6.1.y] cpufreq: amd-pstate: add check for cpufreq_cpu_get's return value
  2024-12-09  4:19 jianqi.ren.cn
@ 2024-12-09 10:07 ` Anastasia Belova
  2024-12-09 14:35 ` Sasha Levin
  1 sibling, 0 replies; 11+ messages in thread
From: Anastasia Belova @ 2024-12-09 10:07 UTC (permalink / raw)
  To: jianqi.ren.cn, gregkh
  Cc: stable, ray.huang, rafael, viresh.kumar, linux-pm, linux-kernel

Hi!

If I'm not mistaken, backport should be accepted to a newer stable 
version 6.6 first.

Also I’ve already sent it [1]. However, I haven't received an answer yet.

[1] 
https://lore.kernel.org/lkml/20241106182000.40167-2-abelova@astralinux.ru/

Anastasia Belova


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 6.1.y] cpufreq: amd-pstate: add check for cpufreq_cpu_get's return value
  2024-12-09  4:19 jianqi.ren.cn
  2024-12-09 10:07 ` Anastasia Belova
@ 2024-12-09 14:35 ` Sasha Levin
  1 sibling, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2024-12-09 14:35 UTC (permalink / raw)
  To: stable; +Cc: jianqi.ren.cn, Sasha Levin

[ Sasha's backport helper bot ]

Hi,

The upstream commit SHA1 provided is correct: 5493f9714e4cdaf0ee7cec15899a231400cb1a9f

WARNING: Author mismatch between patch and upstream commit:
Backport author: <jianqi.ren.cn@windriver.com>
Commit author: Anastasia Belova <abelova@astralinux.ru>


Status in newer kernel trees:
6.12.y | Present (exact SHA1)
6.6.y | Not found
6.1.y | Not found

Note: The patch differs from the upstream commit:
---
1:  5493f9714e4cd < -:  ------------- cpufreq: amd-pstate: add check for cpufreq_cpu_get's return value
-:  ------------- > 1:  f785bc9cf1853 cpufreq: amd-pstate: add check for cpufreq_cpu_get's return value
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.1.y        |  Success    |  Success   |

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 6.1.y] cpufreq: amd-pstate: add check for cpufreq_cpu_get's return value
  2024-12-06 10:41 [PATCH 6.1.y] cpufreq: amd-pstate: add check for cpufreq_cpu_get's return value jianqi.ren.cn
  2024-12-06 10:05 ` Greg KH
  2024-12-06 17:11 ` Sasha Levin
@ 2024-12-11  8:14 ` Greg KH
  2 siblings, 0 replies; 11+ messages in thread
From: Greg KH @ 2024-12-11  8:14 UTC (permalink / raw)
  To: jianqi.ren.cn; +Cc: stable

On Fri, Dec 06, 2024 at 06:41:15PM +0800, jianqi.ren.cn@windriver.com wrote:
> From: Anastasia Belova <abelova@astralinux.ru>
> 
> [ Upstream commit 5493f9714e4cdaf0ee7cec15899a231400cb1a9f ]
> 

Please cc: all relevant people on backports.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH 6.1.y] cpufreq: amd-pstate: add check for cpufreq_cpu_get's return value
@ 2024-12-11  9:53 jianqi.ren.cn
  2024-12-11 16:32 ` Sasha Levin
  0 siblings, 1 reply; 11+ messages in thread
From: jianqi.ren.cn @ 2024-12-11  9:53 UTC (permalink / raw)
  To: abelova, gregkh
  Cc: viresh.kumar, perry.yuan, stable, ray.huang, rafael, linux-pm,
	linux-kernel

From: Anastasia Belova <abelova@astralinux.ru>

[ Upstream commit 5493f9714e4cdaf0ee7cec15899a231400cb1a9f ]

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@astralinux.ru>
Reviewed-by: Perry Yuan <perry.yuan@amd.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Jianqi Ren <jianqi.ren.cn@windriver.com>
---
 drivers/cpufreq/amd-pstate.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index 90dcf26f0973..106aef210003 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -309,9 +309,14 @@ 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);
-	struct amd_cpudata *cpudata = policy->driver_data;
+	struct amd_cpudata *cpudata;
 	unsigned int target_freq;
 
+	if (!policy)
+		return;
+
+	cpudata = policy->driver_data;
+
 	cap_perf = READ_ONCE(cpudata->highest_perf);
 	lowest_nonlinear_perf = READ_ONCE(cpudata->lowest_nonlinear_perf);
 	max_freq = READ_ONCE(cpudata->max_freq);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH 6.1.y] cpufreq: amd-pstate: add check for cpufreq_cpu_get's return value
@ 2024-12-11 10:15 jianqi.ren.cn
  2024-12-11 16:32 ` Sasha Levin
  0 siblings, 1 reply; 11+ messages in thread
From: jianqi.ren.cn @ 2024-12-11 10:15 UTC (permalink / raw)
  To: abelova, gregkh
  Cc: patches, viresh.kumar, perry.yuan, stable, ray.huang, rafael,
	linux-pm, linux-kernel

From: Anastasia Belova <abelova@astralinux.ru>

[ Upstream commit 5493f9714e4cdaf0ee7cec15899a231400cb1a9f ]

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@astralinux.ru>
Reviewed-by: Perry Yuan <perry.yuan@amd.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Jianqi Ren <jianqi.ren.cn@windriver.com>
---
 drivers/cpufreq/amd-pstate.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index 90dcf26f0973..106aef210003 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -309,9 +309,14 @@ 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);
-	struct amd_cpudata *cpudata = policy->driver_data;
+	struct amd_cpudata *cpudata;
 	unsigned int target_freq;
 
+	if (!policy)
+		return;
+
+	cpudata = policy->driver_data;
+
 	cap_perf = READ_ONCE(cpudata->highest_perf);
 	lowest_nonlinear_perf = READ_ONCE(cpudata->lowest_nonlinear_perf);
 	max_freq = READ_ONCE(cpudata->max_freq);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH 6.1.y] cpufreq: amd-pstate: add check for cpufreq_cpu_get's return value
  2024-12-11 10:15 jianqi.ren.cn
@ 2024-12-11 16:32 ` Sasha Levin
  0 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2024-12-11 16:32 UTC (permalink / raw)
  To: stable; +Cc: jianqi.ren.cn, Sasha Levin

[ Sasha's backport helper bot ]

Hi,

The upstream commit SHA1 provided is correct: 5493f9714e4cdaf0ee7cec15899a231400cb1a9f

WARNING: Author mismatch between patch and upstream commit:
Backport author: <jianqi.ren.cn@windriver.com>
Commit author: Anastasia Belova <abelova@astralinux.ru>


Status in newer kernel trees:
6.12.y | Present (exact SHA1)
6.6.y | Not found
6.1.y | Not found

Note: The patch differs from the upstream commit:
---
1:  5493f9714e4cd < -:  ------------- cpufreq: amd-pstate: add check for cpufreq_cpu_get's return value
-:  ------------- > 1:  25946d9ece6d9 cpufreq: amd-pstate: add check for cpufreq_cpu_get's return value
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.1.y        |  Success    |  Success   |

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH 6.1.y] cpufreq: amd-pstate: add check for cpufreq_cpu_get's return value
  2024-12-11  9:53 jianqi.ren.cn
@ 2024-12-11 16:32 ` Sasha Levin
  0 siblings, 0 replies; 11+ messages in thread
From: Sasha Levin @ 2024-12-11 16:32 UTC (permalink / raw)
  To: stable; +Cc: jianqi.ren.cn, Sasha Levin

[ Sasha's backport helper bot ]

Hi,

The upstream commit SHA1 provided is correct: 5493f9714e4cdaf0ee7cec15899a231400cb1a9f

WARNING: Author mismatch between patch and upstream commit:
Backport author: <jianqi.ren.cn@windriver.com>
Commit author: Anastasia Belova <abelova@astralinux.ru>


Status in newer kernel trees:
6.12.y | Present (exact SHA1)
6.6.y | Not found
6.1.y | Not found

Note: The patch differs from the upstream commit:
---
1:  5493f9714e4cd < -:  ------------- cpufreq: amd-pstate: add check for cpufreq_cpu_get's return value
-:  ------------- > 1:  b42c647770dad cpufreq: amd-pstate: add check for cpufreq_cpu_get's return value
---

Results of testing on various branches:

| Branch                    | Patch Apply | Build Test |
|---------------------------|-------------|------------|
| stable/linux-6.1.y        |  Success    |  Success   |

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2024-12-11 16:32 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-06 10:41 [PATCH 6.1.y] cpufreq: amd-pstate: add check for cpufreq_cpu_get's return value jianqi.ren.cn
2024-12-06 10:05 ` Greg KH
2024-12-06 17:11 ` Sasha Levin
2024-12-11  8:14 ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2024-12-09  4:19 jianqi.ren.cn
2024-12-09 10:07 ` Anastasia Belova
2024-12-09 14:35 ` Sasha Levin
2024-12-11  9:53 jianqi.ren.cn
2024-12-11 16:32 ` Sasha Levin
2024-12-11 10:15 jianqi.ren.cn
2024-12-11 16:32 ` Sasha Levin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox