From: sashiko-bot@kernel.org
To: "Mukesh Ojha" <mukesh.ojha@oss.qualcomm.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v2 3/4] firmware: qcom: scm: Add minidump SRAM support
Date: Tue, 19 May 2026 18:04:48 +0000 [thread overview]
Message-ID: <20260519180449.74A22C2BCB3@smtp.kernel.org> (raw)
In-Reply-To: <20260519171442.1582987-4-mukesh.ojha@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] The global `__scm` pointer is read concurrently in `set_minidump_dest()` without the required `smp_load_acquire()` or `READ_ONCE()` barrier, creating a data race.
--
commit 46d7aebbb8abe9c9e0e6c6cfdb3495908a439bbd
Author: Mukesh Ojha <mukesh.ojha@oss.qualcomm.com>
firmware: qcom: scm: Add minidump SRAM support
This commit adds support for writing minidump destination values to
always-on SRAM. It exposes a module parameter to let users select the
destination, which updates the SRAM immediately if minidump mode is active.
> diff --git a/drivers/firmware/qcom/qcom_scm.c b/drivers/firmware/qcom/qcom_scm.c
> --- a/drivers/firmware/qcom/qcom_scm.c
> +++ b/drivers/firmware/qcom/qcom_scm.c
[ ... ]
> @@ -2733,6 +2785,40 @@ static const struct kernel_param_ops download_mode_param_ops = {
[ ... ]
> +static int set_minidump_dest(const char *val, const struct kernel_param *kp)
> +{
> + int i;
> +
> + i = sysfs_match_string(minidump_dest_name, val);
> + if (i < 0)
> + return -EINVAL;
> +
> + minidump_dest = minidump_dest_val[i];
> + if (__scm && __scm->minidump_sram && (download_mode & QCOM_DLOAD_MINIDUMP))
[Severity: Medium]
Could this plain read of __scm result in a data race?
In qcom_scm_probe(), the global __scm pointer is published using
smp_store_release(&__scm, scm). Since module parameters are exposed in
sysfs early, this setter might be executed concurrently while the probe
function is running.
Without a matching smp_load_acquire() or READ_ONCE(), is it possible for
the compiler or CPU to reorder the memory accesses? This might result in
observing a non-NULL __scm but an uninitialized __scm->minidump_sram value,
which could then lead to an arbitrary memory write via writel_relaxed().
Would it be safer to safely acquire the pointer first, for example using:
struct qcom_scm *scm = smp_load_acquire(&__scm);
> + writel_relaxed(minidump_dest, __scm->minidump_sram);
> +
> + return 0;
> +}
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260519171442.1582987-1-mukesh.ojha@oss.qualcomm.com?part=3
next prev parent reply other threads:[~2026-05-19 18:04 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-19 17:14 [PATCH v2 0/4] firmware: qcom: scm: Add minidump SRAM destination support Mukesh Ojha
2026-05-19 17:14 ` [PATCH v2 1/4] dt-bindings: firmware: qcom,scm: Add minidump SRAM property Mukesh Ojha
2026-05-19 17:34 ` sashiko-bot
2026-05-20 10:17 ` Krzysztof Kozlowski
2026-05-22 7:52 ` Mukesh Ojha
2026-05-22 9:15 ` Krzysztof Kozlowski
2026-05-22 15:43 ` Mukesh Ojha
2026-05-19 17:14 ` [PATCH v2 2/4] firmware: qcom: scm: use dev_err_probe() for dload address failure Mukesh Ojha
2026-05-19 17:14 ` [PATCH v2 3/4] firmware: qcom: scm: Add minidump SRAM support Mukesh Ojha
2026-05-19 18:04 ` sashiko-bot [this message]
2026-05-21 10:21 ` Konrad Dybcio
2026-05-22 15:58 ` Mukesh Ojha
2026-05-21 10:21 ` Konrad Dybcio
2026-05-22 15:56 ` Mukesh Ojha
2026-05-19 17:14 ` [PATCH v2 4/4] arm64: dts: qcom: kaanapali: Add minidump SRAM config to SCM node Mukesh Ojha
2026-05-21 10:16 ` Konrad Dybcio
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=20260519180449.74A22C2BCB3@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=mukesh.ojha@oss.qualcomm.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.