public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 6.12.y] cpufreq/amd-pstate: Add missing NULL ptr check in amd_pstate_update
@ 2025-06-17 11:17 jetlan9
  2025-06-19  9:02 ` Sasha Levin
  0 siblings, 1 reply; 2+ messages in thread
From: jetlan9 @ 2025-06-17 11:17 UTC (permalink / raw)
  To: gregkh, stable
  Cc: Dhananjay Ugwekar, Mario Limonciello, Gautham R . Shenoy,
	Wenshan Lan

From: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>

[ Upstream commit 426db24d4db2e4f0d6720aeb7795eafcb9e82640 ]

Check if policy is NULL before dereferencing it in amd_pstate_update.

Fixes: e8f555daacd3 ("cpufreq/amd-pstate: fix setting policy current frequency value")
Signed-off-by: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
Reviewed-by: Gautham R. Shenoy <gautham.shenoy@amd.com>
Link: https://lore.kernel.org/r/20250205112523.201101-11-dhananjay.ugwekar@amd.com
Signed-off-by: Mario Limonciello <mario.limonciello@amd.com>
[Minor context change fixed.]
Signed-off-by: Wenshan Lan <jetlan9@163.com>
---
 drivers/cpufreq/amd-pstate.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/cpufreq/amd-pstate.c b/drivers/cpufreq/amd-pstate.c
index 7a16d1932228..62dbc5701e99 100644
--- a/drivers/cpufreq/amd-pstate.c
+++ b/drivers/cpufreq/amd-pstate.c
@@ -482,6 +482,9 @@ static void amd_pstate_update(struct amd_cpudata *cpudata, u32 min_perf,
 	u32 nominal_perf = READ_ONCE(cpudata->nominal_perf);
 	u64 value = prev;
 
+	if (!policy)
+		return;
+
 	min_perf = clamp_t(unsigned long, min_perf, cpudata->min_limit_perf,
 			cpudata->max_limit_perf);
 	max_perf = clamp_t(unsigned long, max_perf, cpudata->min_limit_perf,
-- 
2.34.1


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

* Re: [PATCH 6.12.y] cpufreq/amd-pstate: Add missing NULL ptr check in amd_pstate_update
  2025-06-17 11:17 [PATCH 6.12.y] cpufreq/amd-pstate: Add missing NULL ptr check in amd_pstate_update jetlan9
@ 2025-06-19  9:02 ` Sasha Levin
  0 siblings, 0 replies; 2+ messages in thread
From: Sasha Levin @ 2025-06-19  9:02 UTC (permalink / raw)
  To: stable; +Cc: jetlan9, Sasha Levin

[ Sasha's backport helper bot ]

Hi,

✅ All tests passed successfully. No issues detected.
No action required from the submitter.

The upstream commit SHA1 provided is correct: 426db24d4db2e4f0d6720aeb7795eafcb9e82640

WARNING: Author mismatch between patch and upstream commit:
Backport author: jetlan9@163.com
Commit author: Dhananjay Ugwekar<dhananjay.ugwekar@amd.com>

Status in newer kernel trees:
6.15.y | Present (exact SHA1)

Note: The patch differs from the upstream commit:
---
1:  426db24d4db2e < -:  ------------- cpufreq/amd-pstate: Add missing NULL ptr check in amd_pstate_update
-:  ------------- > 1:  d77c661c72a28 cpufreq/amd-pstate: Add missing NULL ptr check in amd_pstate_update
---

Results of testing on various branches:

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

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

end of thread, other threads:[~2025-06-19  9:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-17 11:17 [PATCH 6.12.y] cpufreq/amd-pstate: Add missing NULL ptr check in amd_pstate_update jetlan9
2025-06-19  9:02 ` Sasha Levin

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