* [PATCH 0/2] firmware: arm_scmi: fix shared memory and protocol table
@ 2026-11-16 12:31 Philip Radford
2026-11-16 12:31 ` [PATCH 1/2] firmware: arm_scmi: uninitialized reg_io_width in shmem_setup_iomap() Philip Radford
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Philip Radford @ 2026-11-16 12:31 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel, arm-scmi
Cc: sudeep.holla, cristian.marussi, philip.radford
Hi,
Here is a short seires to address two SCMI bugs reported by Sashiko.
Patch [1/2] slightly alters logic to avoid using an uninitialized
reg_io_width value when selecting shared memory accessors.
Patch [2/2] handles missing SCMI protocol ID tables in registration and
unregistration paths.
Based on V7.4-rc2.
Thank you,
Phil.
Philip Radford (2):
firmware: arm_scmi: uninitialized reg_io_width in shmem_setup_iomap()
firmware: arm_scmi: null pointer dereference in
scmi_protocol_table_register()
drivers/firmware/arm_scmi/bus.c | 10 ++++++++--
drivers/firmware/arm_scmi/shmem.c | 11 +++--------
2 files changed, 11 insertions(+), 10 deletions(-)
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] firmware: arm_scmi: uninitialized reg_io_width in shmem_setup_iomap()
2026-11-16 12:31 [PATCH 0/2] firmware: arm_scmi: fix shared memory and protocol table Philip Radford
@ 2026-11-16 12:31 ` Philip Radford
2026-11-16 12:31 ` [PATCH 2/2] firmware: arm_scmi: null pointer dereference in scmi_protocol_table_register() Philip Radford
2026-11-19 13:55 ` [PATCH 0/2] firmware: arm_scmi: fix shared memory and protocol table Sudeep Holla
2 siblings, 0 replies; 5+ messages in thread
From: Philip Radford @ 2026-11-16 12:31 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel, arm-scmi
Cc: sudeep.holla, cristian.marussi, philip.radford, Sashiko
Replace switch by setting scmi_shmem_io_ops to use default and only
changing if reg-io-width read suceeds and has a width of 4.
Fixes: 2cd7f3db25fe ("firmware: arm_scmi: Support 'reg-io-width' property for shared memory")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/bug/linux-dd042f6f-0b76-40b8-9435-cbc53370cd08
Signed-off-by: Philip Radford <philip.radford@arm.com>
---
drivers/firmware/arm_scmi/shmem.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/firmware/arm_scmi/shmem.c b/drivers/firmware/arm_scmi/shmem.c
index dadb37557f8a..8a4557a1e5c2 100644
--- a/drivers/firmware/arm_scmi/shmem.c
+++ b/drivers/firmware/arm_scmi/shmem.c
@@ -234,16 +234,11 @@ static void __iomem *shmem_setup_iomap(struct scmi_chan_info *cinfo,
dev_err(dev, "failed to ioremap SCMI %s shared memory\n", desc);
return IOMEM_ERR_PTR(-EADDRNOTAVAIL);
}
+ *ops = &shmem_io_ops_default;
- of_property_read_u32(shmem, "reg-io-width", ®_io_width);
- switch (reg_io_width) {
- case 4:
+ if (!of_property_read_u32(shmem, "reg-io-width", ®_io_width) &&
+ reg_io_width == 4)
*ops = &shmem_io_ops32;
- break;
- default:
- *ops = &shmem_io_ops_default;
- break;
- }
return addr;
}
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] firmware: arm_scmi: null pointer dereference in scmi_protocol_table_register()
2026-11-16 12:31 [PATCH 0/2] firmware: arm_scmi: fix shared memory and protocol table Philip Radford
2026-11-16 12:31 ` [PATCH 1/2] firmware: arm_scmi: uninitialized reg_io_width in shmem_setup_iomap() Philip Radford
@ 2026-11-16 12:31 ` Philip Radford
2026-11-19 13:55 ` [PATCH 0/2] firmware: arm_scmi: fix shared memory and protocol table Sudeep Holla
2 siblings, 0 replies; 5+ messages in thread
From: Philip Radford @ 2026-11-16 12:31 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel, arm-scmi
Cc: sudeep.holla, cristian.marussi, philip.radford, Sashiko
Add checks to avoid dereferencing a null pointer in
scmi_protocol_table_register() and scmi_protocol_table_unregister()
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://sashiko.dev/#/bug/linux-7330d90b-8d81-478a-a227-4aa6f19393ba
Fixes: 2858f6e5f064 ("firmware: arm_scmi: Add multiple protocols registration support")
Signed-off-by: Philip Radford <philip.radford@arm.com>
---
drivers/firmware/arm_scmi/bus.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/firmware/arm_scmi/bus.c b/drivers/firmware/arm_scmi/bus.c
index 25197197db8e..337aa445e42d 100644
--- a/drivers/firmware/arm_scmi/bus.c
+++ b/drivers/firmware/arm_scmi/bus.c
@@ -186,6 +186,9 @@ static int scmi_protocol_table_register(const struct scmi_device_id *id_table)
const struct scmi_device_id *entry;
int ret;
+ if (!id_table)
+ return -ENOENT;
+
for (entry = id_table; entry->name[0]; entry++) {
ret = scmi_protocol_device_request(entry);
if (ret)
@@ -206,8 +209,11 @@ scmi_protocol_table_unregister(const struct scmi_device_id *id_table)
{
const struct scmi_device_id *entry;
- for (entry = id_table; entry->name[0]; entry++)
- scmi_protocol_device_unrequest(entry);
+ if (id_table) {
+ for (entry = id_table; entry->name[0]; entry++)
+ scmi_protocol_device_unrequest(entry);
+ }
+
}
static bool scmi_device_is_transport(const struct scmi_device *scmi_dev)
--
2.34.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] firmware: arm_scmi: fix shared memory and protocol table
2026-11-16 12:31 [PATCH 0/2] firmware: arm_scmi: fix shared memory and protocol table Philip Radford
2026-11-16 12:31 ` [PATCH 1/2] firmware: arm_scmi: uninitialized reg_io_width in shmem_setup_iomap() Philip Radford
2026-11-16 12:31 ` [PATCH 2/2] firmware: arm_scmi: null pointer dereference in scmi_protocol_table_register() Philip Radford
@ 2026-11-19 13:55 ` Sudeep Holla
2026-11-19 15:41 ` Philip Radford
2 siblings, 1 reply; 5+ messages in thread
From: Sudeep Holla @ 2026-11-19 13:55 UTC (permalink / raw)
To: linux-kernel, linux-arm-kernel, arm-scmi, Philip Radford
Cc: Sudeep Holla, cristian.marussi
On Mon, 16 Nov 2026 12:31:51 +0000, Philip Radford wrote:
> Here is a short seires to address two SCMI bugs reported by Sashiko.
>
> Patch [1/2] slightly alters logic to avoid using an uninitialized
> reg_io_width value when selecting shared memory accessors.
>
> Patch [2/2] handles missing SCMI protocol ID tables in registration and
> unregistration paths.
>
> [...]
Hi Philip,
Please avoid using bug report as subject line also. I have rebased the
change on for-next/arm_fw/updates as I have moved files. Also I did
rewrite a bit of commit message and kept !id_table check consistent
across register and unregister. Please check the branch and shout if
you disagree.
Applied to sudeep.holla/linux (for-next/arm_fw/updates), thanks!
[1/2] firmware: arm_scmi: uninitialized reg_io_width in shmem_setup_iomap()
https://git.kernel.org/sudeep.holla/c/8db620083cf2
[2/2] firmware: arm_scmi: null pointer dereference in scmi_protocol_table_register()
https://git.kernel.org/sudeep.holla/c/99e55aac0f9c
--
Regards,
Sudeep
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 0/2] firmware: arm_scmi: fix shared memory and protocol table
2026-11-19 13:55 ` [PATCH 0/2] firmware: arm_scmi: fix shared memory and protocol table Sudeep Holla
@ 2026-11-19 15:41 ` Philip Radford
0 siblings, 0 replies; 5+ messages in thread
From: Philip Radford @ 2026-11-19 15:41 UTC (permalink / raw)
To: Sudeep Holla; +Cc: linux-kernel, linux-arm-kernel, arm-scmi, cristian.marussi
On Thu, Nov 19, 2026 at 01:55:17PM +0000, Sudeep Holla wrote:
> On Mon, 16 Nov 2026 12:31:51 +0000, Philip Radford wrote:
> > Here is a short seires to address two SCMI bugs reported by Sashiko.
> >
> > Patch [1/2] slightly alters logic to avoid using an uninitialized
> > reg_io_width value when selecting shared memory accessors.
> >
> > Patch [2/2] handles missing SCMI protocol ID tables in registration and
> > unregistration paths.
> >
> > [...]
>
> Hi Philip,
>
Hi,
> Please avoid using bug report as subject line also. I have rebased the
> change on for-next/arm_fw/updates as I have moved files. Also I did
> rewrite a bit of commit message and kept !id_table check consistent
> across register and unregister. Please check the branch and shout if
> you disagree.
>
> Applied to sudeep.holla/linux (for-next/arm_fw/updates), thanks!
>
> [1/2] firmware: arm_scmi: uninitialized reg_io_width in shmem_setup_iomap()
> https://git.kernel.org/sudeep.holla/c/8db620083cf2
> [2/2] firmware: arm_scmi: null pointer dereference in scmi_protocol_table_register()
> https://git.kernel.org/sudeep.holla/c/99e55aac0f9c
Noted with regards to the subject line, and I agree your ammendments
look cleaner.
Regards,
Phil
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-19 15:41 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-11-16 12:31 [PATCH 0/2] firmware: arm_scmi: fix shared memory and protocol table Philip Radford
2026-11-16 12:31 ` [PATCH 1/2] firmware: arm_scmi: uninitialized reg_io_width in shmem_setup_iomap() Philip Radford
2026-11-16 12:31 ` [PATCH 2/2] firmware: arm_scmi: null pointer dereference in scmi_protocol_table_register() Philip Radford
2026-11-19 13:55 ` [PATCH 0/2] firmware: arm_scmi: fix shared memory and protocol table Sudeep Holla
2026-11-19 15:41 ` Philip Radford
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®