From: Sudeep Holla <sudeep.holla@kernel.org>
To: arm-scmi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
kernel-team@meta.com
Cc: Cristian Marussi <cristian.marussi@arm.com>,
Breno Leitao <leitao@debian.org>
Subject: [PATCH v3 9/9] firmware: arm_scmi: Validate PCC shared memory signature
Date: Thu, 13 Aug 2026 12:33:04 +0100 [thread overview]
Message-ID: <20260813-acpi_scmi_pcc-v3-9-cb6b88b4ebb3@kernel.org> (raw)
In-Reply-To: <20260813-acpi_scmi_pcc-v3-0-cb6b88b4ebb3@kernel.org>
Validate the PCC shared memory signature when setting up an SCMI PCC
channel.
Reject channels whose shared memory signature does not encode
PCC_SIGNATURE combined with the PCC subspace ID, so misconfigured
firmware is caught before the transport starts using the shared memory
region.
Signed-off-by: Sudeep Holla <sudeep.holla@kernel.org>
---
drivers/firmware/arm_scmi/transports/pcc.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/arm_scmi/transports/pcc.c b/drivers/firmware/arm_scmi/transports/pcc.c
index 337d551e3ad8..0ead0ec77162 100644
--- a/drivers/firmware/arm_scmi/transports/pcc.c
+++ b/drivers/firmware/arm_scmi/transports/pcc.c
@@ -623,8 +623,11 @@ static void rx_callback(struct mbox_client *cl, void *m)
}
static int pcc_chan_validate_shmem(struct scmi_chan_info *cinfo,
- struct scmi_pcc *smbox)
+ struct scmi_pcc *smbox, int ss_id)
{
+ struct pcc_shared_mem __iomem *shmem = smbox->pchan->shmem;
+ u32 valid_signature = ss_id + PCC_SIGNATURE;
+
if (smbox->pchan->shmem_size < SCMI_PCC_SHMEM_OVERHEAD ||
smbox->pchan->shmem_size - SCMI_PCC_SHMEM_OVERHEAD <
cinfo->max_msg_size) {
@@ -632,6 +635,11 @@ static int pcc_chan_validate_shmem(struct scmi_chan_info *cinfo,
return -ENOSPC;
}
+ if (ioread32(&shmem->header.signature) != valid_signature) {
+ dev_err(cinfo->dev, "invalid PCC shared memory signature\n");
+ return -EINVAL;
+ }
+
return 0;
}
@@ -667,7 +675,7 @@ static int pcc_chan_setup(struct scmi_chan_info *cinfo, struct device *dev,
return ret;
}
- ret = pcc_chan_validate_shmem(cinfo, smbox);
+ ret = pcc_chan_validate_shmem(cinfo, smbox, ss_id);
if (ret) {
pcc_mbox_free_channel(smbox->pchan);
return ret;
--
2.43.0
prev parent reply other threads:[~2026-08-13 11:34 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-13 11:32 [PATCH v3 0/9] firmware: arm_scmi: Refactoring and enablement of ACPI PCC transport Sudeep Holla
2026-08-13 11:32 ` [PATCH v3 1/9] firmware: arm_scmi: Set fwnode for the generated SCMI platform device Sudeep Holla
2026-08-13 11:32 ` [PATCH v3 2/9] firmware: arm_scmi: Extend transport driver macro to support ACPI Sudeep Holla
2026-08-13 11:32 ` [PATCH v3 3/9] firmware: arm_scmi: Convert OF-only paths to generic fwnode in SCMI core Sudeep Holla
2026-08-13 11:32 ` [PATCH v3 4/9] firmware: arm_scmi: Fall back to ACPI HID when "compatible" is absent Sudeep Holla
2026-08-13 11:33 ` [PATCH v3 5/9] firmware: arm_scmi: Pass protocol ID to chan_available() transport callback Sudeep Holla
2026-08-13 11:33 ` [PATCH v3 6/9] firmware: arm_scmi: Refactor protocol device creation logic Sudeep Holla
2026-08-13 11:33 ` [PATCH v3 7/9] firmware: arm_scmi: Add ACPI PCC transport Sudeep Holla
2026-08-13 11:33 ` [PATCH v3 8/9] firmware: arm_scmi: Initialise known ACPI protocol devices and channels Sudeep Holla
2026-08-13 11:33 ` Sudeep Holla [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=20260813-acpi_scmi_pcc-v3-9-cb6b88b4ebb3@kernel.org \
--to=sudeep.holla@kernel.org \
--cc=arm-scmi@vger.kernel.org \
--cc=cristian.marussi@arm.com \
--cc=kernel-team@meta.com \
--cc=leitao@debian.org \
--cc=linux-arm-kernel@lists.infradead.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