Linux-ARM-Kernel Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: <gregkh@linuxfoundation.org>
To: ajay.kaher@broadcom.com,alexey.makhalov@broadcom.com,bsdhenrymartin@gmail.com,cristian.marussi@arm.com,gregkh@linuxfoundation.org,linux-arm-kernel@lists.infradead.org,rafael@kernel.org,sashal@kernel.org,shivani.agarwal@broadcom.com,sudeep.holla@arm.com,tapas.kundu@broadcom.com,vamsi-krishna.brahmajosyula@broadcom.com,viresh.kumar@linaro.org,yin.ding@broadcom.com
Cc: <stable-commits@vger.kernel.org>
Subject: Patch "cpufreq: scmi: Fix null-ptr-deref in scmi_cpufreq_get_rate()" has been added to the 5.10-stable tree
Date: Thu, 08 Jan 2026 17:27:37 +0100	[thread overview]
Message-ID: <2026010837-cornea-pregnancy-a181@gregkh> (raw)
In-Reply-To: <20260105095701.659420-1-shivani.agarwal@broadcom.com>


This is a note to let you know that I've just added the patch titled

    cpufreq: scmi: Fix null-ptr-deref in scmi_cpufreq_get_rate()

to the 5.10-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     cpufreq-scmi-fix-null-ptr-deref-in-scmi_cpufreq_get_rate.patch
and it can be found in the queue-5.10 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.


From stable+bounces-204627-greg=kroah.com@vger.kernel.org Mon Jan  5 11:19:06 2026
From: Shivani Agarwal <shivani.agarwal@broadcom.com>
Date: Mon,  5 Jan 2026 01:57:01 -0800
Subject: cpufreq: scmi: Fix null-ptr-deref in scmi_cpufreq_get_rate()
To: stable@vger.kernel.org, gregkh@linuxfoundation.org
Cc: sudeep.holla@arm.com, cristian.marussi@arm.com, rafael@kernel.org, viresh.kumar@linaro.org, arm-scmi@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, ajay.kaher@broadcom.com, alexey.makhalov@broadcom.com, vamsi-krishna.brahmajosyula@broadcom.com, yin.ding@broadcom.com, tapas.kundu@broadcom.com, Henry Martin <bsdhenrymartin@gmail.com>, Sasha Levin <sashal@kernel.org>, Shivani Agarwal <shivani.agarwal@broadcom.com>
Message-ID: <20260105095701.659420-1-shivani.agarwal@broadcom.com>

From: Henry Martin <bsdhenrymartin@gmail.com>

[ Upstream commit 484d3f15cc6cbaa52541d6259778e715b2c83c54 ]

cpufreq_cpu_get_raw() can return NULL when the target CPU is not present
in the policy->cpus mask. scmi_cpufreq_get_rate() does not check for
this case, which results in a NULL pointer dereference.

Add NULL check after cpufreq_cpu_get_raw() to prevent this issue.

Fixes: 99d6bdf33877 ("cpufreq: add support for CPU DVFS based on SCMI message protocol")
Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com>
Acked-by: Sudeep Holla <sudeep.holla@arm.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
[Shivani: Modified to apply on 5.10.y]
Signed-off-by: Shivani Agarwal <shivani.agarwal@broadcom.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/cpufreq/scmi-cpufreq.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

--- a/drivers/cpufreq/scmi-cpufreq.c
+++ b/drivers/cpufreq/scmi-cpufreq.c
@@ -29,12 +29,18 @@ static const struct scmi_handle *handle;
 
 static unsigned int scmi_cpufreq_get_rate(unsigned int cpu)
 {
-	struct cpufreq_policy *policy = cpufreq_cpu_get_raw(cpu);
+	struct cpufreq_policy *policy;
+	struct scmi_data *priv;
 	const struct scmi_perf_ops *perf_ops = handle->perf_ops;
-	struct scmi_data *priv = policy->driver_data;
 	unsigned long rate;
 	int ret;
 
+	policy = cpufreq_cpu_get_raw(cpu);
+	if (unlikely(!policy))
+		return 0;
+
+	priv = policy->driver_data;
+
 	ret = perf_ops->freq_get(handle, priv->domain_id, &rate, false);
 	if (ret)
 		return 0;


Patches currently in stable-queue which might be from shivani.agarwal@broadcom.com are

queue-5.10/usb-xhci-move-link-chain-bit-quirk-checks-into-one-helper-function.patch
queue-5.10/crypto-af_alg-zero-initialize-memory-allocated-via-sock_kmalloc.patch
queue-5.10/rdma-core-fix-kasan-slab-use-after-free-read-in-ib_register_device-problem.patch
queue-5.10/ovl-use-buf-flexible-array-for-memcpy-destination.patch
queue-5.10/cpufreq-scmi-fix-null-ptr-deref-in-scmi_cpufreq_get_rate.patch
queue-5.10/drm-vmwgfx-fix-a-null-ptr-access-in-the-cursor-snooper.patch
queue-5.10/scsi-iscsi_tcp-fix-uaf-during-logout-when-accessing-the-shost-ipaddress.patch
queue-5.10/usb-xhci-apply-the-link-chain-quirk-on-nec-isoc-endpoints.patch
queue-5.10/scsi-iscsi-move-pool-freeing.patch


      reply	other threads:[~2026-01-08 16:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-05  9:57 [PATCH v5.10] cpufreq: scmi: Fix null-ptr-deref in scmi_cpufreq_get_rate() Shivani Agarwal
2026-01-08 16:27 ` gregkh [this message]

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=2026010837-cornea-pregnancy-a181@gregkh \
    --to=gregkh@linuxfoundation.org \
    --cc=ajay.kaher@broadcom.com \
    --cc=alexey.makhalov@broadcom.com \
    --cc=bsdhenrymartin@gmail.com \
    --cc=cristian.marussi@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=rafael@kernel.org \
    --cc=sashal@kernel.org \
    --cc=shivani.agarwal@broadcom.com \
    --cc=stable-commits@vger.kernel.org \
    --cc=sudeep.holla@arm.com \
    --cc=tapas.kundu@broadcom.com \
    --cc=vamsi-krishna.brahmajosyula@broadcom.com \
    --cc=viresh.kumar@linaro.org \
    --cc=yin.ding@broadcom.com \
    /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