Skip to contentSkip to conversation

cpufreq/amd-pstate: Add missing NULL ptr check in amd_pstate_update

PATCH In review [email protected] 2 participants 2 messages Jun 17, 2025 – Jun 19, 2025 Stable branch

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 cpufreq/amd-pstate: Add missing NULL ptr check in amd_pstate_update

From: Dhananjay Ugwekar <[email protected]>

[ 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")
[Minor context change fixed.]
---
 drivers/cpufreq/amd-pstate.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/cpufreq/amd-pstate.c +3 -0
index 7a16d1932228..62dbc5701e99 100644
@@ -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,
Signature · 1 line
2.34.1
maintainer
#1 lore raw

[ 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: [email protected]
Commit author: Dhananjay Ugwekar<[email protected]>

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   |