From: jetlan9@163.com
To: gregkh@linuxfoundation.org, stable@vger.kernel.org
Cc: Dhananjay Ugwekar <dhananjay.ugwekar@amd.com>,
Mario Limonciello <mario.limonciello@amd.com>,
"Gautham R . Shenoy" <gautham.shenoy@amd.com>,
Wenshan Lan <jetlan9@163.com>
Subject: [PATCH 6.12.y] cpufreq/amd-pstate: Add missing NULL ptr check in amd_pstate_update
Date: Tue, 17 Jun 2025 19:17:56 +0800 [thread overview]
Message-ID: <20250617111756.970-1-jetlan9@163.com> (raw)
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
next reply other threads:[~2025-06-17 11:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-17 11:17 jetlan9 [this message]
2025-06-19 9:02 ` [PATCH 6.12.y] cpufreq/amd-pstate: Add missing NULL ptr check in amd_pstate_update Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250617111756.970-1-jetlan9@163.com \
--to=jetlan9@163.com \
--cc=dhananjay.ugwekar@amd.com \
--cc=gautham.shenoy@amd.com \
--cc=gregkh@linuxfoundation.org \
--cc=mario.limonciello@amd.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox