Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/10] mailbox: Fix Critical and High issues reported by Sashiko
@ 2026-12-03  8:28 Lee Jones
  2026-12-03  8:28 ` [PATCH 03/10] mailbox: riscv-sbi-mpxy: Protect per-CPU shmem access with irqsave Lee Jones
  2026-12-03  8:28 ` [PATCH 04/10] mailbox: riscv-sbi-mpxy: Validate shmem bounds in message send helpers Lee Jones
  0 siblings, 2 replies; 5+ messages in thread
From: Lee Jones @ 2026-12-03  8:28 UTC (permalink / raw)
  To: lee
  Cc: linux-kernel, Albert Ou, Alexandre Ghiti, Anup Patel,
	Beleswar Padhi, Bjorn Andersson, Chen-Yu Tsai, Huang Yiwei,
	Jassi Brar, Jernej Skrabec, Kumar Gutta, linux-arm-kernel,
	linux-arm-msm, linux-riscv, linux-sunxi, Manivannan Sadhasivam,
	Nishanth Menon, Palmer Dabbelt, Pan Chuang, Paul Walmsley,
	Philipp Zabel, Raghavendra Rao Ananta, Rahul Pathak, Rob Rice,
	Samuel Holland, Sudeep Holla, Thierry Reding

This series fixes 10 Critical and High issues across mailbox controller
drivers (qcom-ipcc, ti-msgmgr, riscv-sbi-mpxy, bcm-pdc, sun6i-msgbox,
and arm_mhu_db), covering uninitialised phandle puts, signed index and
shmem out-of-bounds accesses, per-CPU hardirq races, DMA pool and IRQ
domain teardown use-after-frees, IRQ/clock/shutdown synchronisation
races, premature controller registration, and silent queue-error
returns.

These issues were reported by Sashiko.

Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Anup Patel <apatel@ventanamicro.com>
Cc: Beleswar Padhi <b-padhi@ti.com>
Cc: Bjorn Andersson <andersson@kernel.org>
Cc: Chen-Yu Tsai <wens@kernel.org>
Cc: Huang Yiwei <quic_hyiwei@quicinc.com>
Cc: Jassi Brar <jassisinghbrar@gmail.com>
Cc: Jernej Skrabec <jernej.skrabec@gmail.com>
Cc: Kumar Gutta <vnkgutta@codeaurora.org>
Cc: linux-arm-kernel@lists.infradead.org
Cc: linux-arm-msm@vger.kernel.org
Cc: linux-riscv@lists.infradead.org
Cc: linux-sunxi@lists.linux.dev
Cc: Manivannan Sadhasivam <mani@kernel.org>
Cc: Nishanth Menon <nm@ti.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Pan Chuang <panchuang@vivo.com>
Cc: Paul Walmsley <pjw@kernel.org>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
Cc: Raghavendra Rao Ananta <rananta@codeaurora.org>
Cc: Rahul Pathak <rahul@summations.net>
Cc: Rob Rice <rob.rice@broadcom.com>
Cc: Samuel Holland <samuel@sholland.org>
Cc: Sudeep Holla <sudeep.holla@kernel.org>
Cc: Thierry Reding <treding@nvidia.com>

Lee Jones (10):
  mailbox: qcom-ipcc: Skip of_node_put() on phandle parse failure
  mailbox: ti-msgmgr: Use unsigned IDs in ti_msgmgr_of_xlate()
  mailbox: riscv-sbi-mpxy: Protect per-CPU shmem access with irqsave
  mailbox: riscv-sbi-mpxy: Validate shmem bounds in message send helpers
  mailbox: bcm-pdc: Unregister mailbox controller before destroying DMA
    pools
  mailbox: qcom-ipcc: Remove IRQ domain via devm to avoid ISR
    use-after-free
  mailbox: sun6i-msgbox: Free IRQ before disabling clock on teardown
  mailbox: sun6i-msgbox: Synchronise IRQ during channel shutdown
  mailbox: arm_mhu_db: Initialise channel registers before controller
    registration
  mailbox: ti-msgmgr: Return -EIO on queue error in
    ti_msgmgr_send_data()

 drivers/mailbox/arm_mhu_db.c          |  19 ++--
 drivers/mailbox/bcm-pdc-mailbox.c     |   4 +-
 drivers/mailbox/qcom-ipcc.c           |  33 ++++---
 drivers/mailbox/riscv-sbi-mpxy-mbox.c | 121 ++++++++++++++------------
 drivers/mailbox/sun6i-msgbox.c        |  25 ++++--
 drivers/mailbox/ti-msgmgr.c           |   8 +-
 6 files changed, 118 insertions(+), 92 deletions(-)

-- 
2.56.1.911.g883d8bcb20-goog


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH 03/10] mailbox: riscv-sbi-mpxy: Protect per-CPU shmem access with irqsave
  2026-12-03  8:28 [PATCH 00/10] mailbox: Fix Critical and High issues reported by Sashiko Lee Jones
@ 2026-12-03  8:28 ` Lee Jones
  2026-12-03 14:32   ` Rahul Pathak
  2026-12-03  8:28 ` [PATCH 04/10] mailbox: riscv-sbi-mpxy: Validate shmem bounds in message send helpers Lee Jones
  1 sibling, 1 reply; 5+ messages in thread
From: Lee Jones @ 2026-12-03  8:28 UTC (permalink / raw)
  To: lee
  Cc: linux-kernel, stable, Albert Ou, Alexandre Ghiti, Anup Patel,
	Jassi Brar, linux-riscv, Palmer Dabbelt, Paul Walmsley,
	Rahul Pathak

The SBI MPXY helpers evaluate this_cpu_ptr(&mpxy_local) before calling
get_cpu(), allowing CPU migration between computing the per-CPU pointer
and disabling preemption.  They also leave local interrupts enabled
while using the per-CPU shared memory buffer, allowing a hardirq caller
(such as mbox_send_message() or mpxy_mbox_msi_write()) to clobber the
shared memory buffer mid-operation.

Use guard(irqsave)() across all per-CPU shared memory helpers and fetch
this_cpu_ptr(&mpxy_local) inside the IRQ-disabled section.

Fixes: bf3022a4eb11 ("mailbox: Add RISC-V SBI message proxy (MPXY) based mailbox driver")
Closes: https://sashiko.dev/#/bug/linux-d2c1eefe-4777-4ad6-94c5-504e347f3add
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---

Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Anup Patel <apatel@ventanamicro.com>
Cc: Jassi Brar <jassisinghbrar@gmail.com>
Cc: linux-riscv@lists.infradead.org
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <pjw@kernel.org>
Cc: Rahul Pathak <rahul@summations.net>

 drivers/mailbox/riscv-sbi-mpxy-mbox.c | 114 +++++++++++++-------------
 1 file changed, 59 insertions(+), 55 deletions(-)

diff --git a/drivers/mailbox/riscv-sbi-mpxy-mbox.c b/drivers/mailbox/riscv-sbi-mpxy-mbox.c
index 4ebce35a8b6c..90b1972a42ea 100644
--- a/drivers/mailbox/riscv-sbi-mpxy-mbox.c
+++ b/drivers/mailbox/riscv-sbi-mpxy-mbox.c
@@ -6,10 +6,12 @@
  */
 
 #include <linux/acpi.h>
+#include <linux/cleanup.h>
 #include <linux/cpu.h>
 #include <linux/errno.h>
 #include <linux/init.h>
 #include <linux/irqchip/riscv-imsic.h>
+#include <linux/irqflags.h>
 #include <linux/mailbox_controller.h>
 #include <linux/mailbox/riscv-rpmi-message.h>
 #include <linux/minmax.h>
@@ -127,52 +129,57 @@ static bool mpxy_shmem_init_done;
 
 static int mpxy_get_channel_count(u32 *channel_count)
 {
-	struct mpxy_local *mpxy = this_cpu_ptr(&mpxy_local);
-	struct sbi_mpxy_channel_ids_data *sdata = mpxy->shmem;
+	struct sbi_mpxy_channel_ids_data *sdata;
+	struct mpxy_local *mpxy;
 	u32 remaining, returned;
 	struct sbiret sret;
 
-	if (!mpxy->shmem_active)
-		return -ENODEV;
 	if (!channel_count)
 		return -EINVAL;
 
-	get_cpu();
+	guard(irqsave)();
+
+	mpxy = this_cpu_ptr(&mpxy_local);
+	if (!mpxy->shmem_active)
+		return -ENODEV;
 
 	/* Get the remaining and returned fields to calculate total */
 	sret = sbi_ecall(SBI_EXT_MPXY, SBI_EXT_MPXY_GET_CHANNEL_IDS,
 			 0, 0, 0, 0, 0, 0);
 	if (sret.error)
-		goto err_put_cpu;
+		return sbi_err_map_linux_errno(sret.error);
 
+	sdata = mpxy->shmem;
 	remaining = le32_to_cpu(sdata->remaining);
 	returned = le32_to_cpu(sdata->returned);
 	*channel_count = remaining + returned;
 
-err_put_cpu:
-	put_cpu();
-	return sbi_err_map_linux_errno(sret.error);
+	return 0;
 }
 
 static int mpxy_get_channel_ids(u32 channel_count, u32 *channel_ids)
 {
-	struct mpxy_local *mpxy = this_cpu_ptr(&mpxy_local);
-	struct sbi_mpxy_channel_ids_data *sdata = mpxy->shmem;
 	u32 remaining, returned, count, start_index = 0;
+	struct sbi_mpxy_channel_ids_data *sdata;
+	struct mpxy_local *mpxy;
 	struct sbiret sret;
 
-	if (!mpxy->shmem_active)
-		return -ENODEV;
 	if (!channel_count || !channel_ids)
 		return -EINVAL;
 
-	get_cpu();
+	guard(irqsave)();
+
+	mpxy = this_cpu_ptr(&mpxy_local);
+	if (!mpxy->shmem_active)
+		return -ENODEV;
+
+	sdata = mpxy->shmem;
 
 	do {
 		sret = sbi_ecall(SBI_EXT_MPXY, SBI_EXT_MPXY_GET_CHANNEL_IDS,
 				 start_index, 0, 0, 0, 0, 0);
 		if (sret.error)
-			goto err_put_cpu;
+			return sbi_err_map_linux_errno(sret.error);
 
 		remaining = le32_to_cpu(sdata->remaining);
 		returned = le32_to_cpu(sdata->returned);
@@ -183,54 +190,53 @@ static int mpxy_get_channel_ids(u32 channel_count, u32 *channel_ids)
 		start_index += count;
 	} while (remaining && start_index < channel_count);
 
-err_put_cpu:
-	put_cpu();
-	return sbi_err_map_linux_errno(sret.error);
+	return 0;
 }
 
 static int mpxy_read_attrs(u32 channel_id, u32 base_attrid, u32 attr_count,
 			   u32 *attrs_buf)
 {
-	struct mpxy_local *mpxy = this_cpu_ptr(&mpxy_local);
+	struct mpxy_local *mpxy;
 	struct sbiret sret;
 
-	if (!mpxy->shmem_active)
-		return -ENODEV;
 	if (!attr_count || !attrs_buf)
 		return -EINVAL;
 
-	get_cpu();
+	guard(irqsave)();
+
+	mpxy = this_cpu_ptr(&mpxy_local);
+	if (!mpxy->shmem_active)
+		return -ENODEV;
 
 	sret = sbi_ecall(SBI_EXT_MPXY, SBI_EXT_MPXY_READ_ATTRS,
 			 channel_id, base_attrid, attr_count, 0, 0, 0);
 	if (sret.error)
-		goto err_put_cpu;
+		return sbi_err_map_linux_errno(sret.error);
 
 	memcpy_from_le32(attrs_buf, (__le32 *)mpxy->shmem, attr_count);
 
-err_put_cpu:
-	put_cpu();
-	return sbi_err_map_linux_errno(sret.error);
+	return 0;
 }
 
 static int mpxy_write_attrs(u32 channel_id, u32 base_attrid, u32 attr_count,
 			    u32 *attrs_buf)
 {
-	struct mpxy_local *mpxy = this_cpu_ptr(&mpxy_local);
+	struct mpxy_local *mpxy;
 	struct sbiret sret;
 
-	if (!mpxy->shmem_active)
-		return -ENODEV;
 	if (!attr_count || !attrs_buf)
 		return -EINVAL;
 
-	get_cpu();
+	guard(irqsave)();
+
+	mpxy = this_cpu_ptr(&mpxy_local);
+	if (!mpxy->shmem_active)
+		return -ENODEV;
 
 	memcpy_to_le32((__le32 *)mpxy->shmem, attrs_buf, attr_count);
 	sret = sbi_ecall(SBI_EXT_MPXY, SBI_EXT_MPXY_WRITE_ATTRS,
 			 channel_id, base_attrid, attr_count, 0, 0, 0);
 
-	put_cpu();
 	return sbi_err_map_linux_errno(sret.error);
 }
 
@@ -239,16 +245,18 @@ static int mpxy_send_message_with_resp(u32 channel_id, u32 msg_id,
 				       void *rx, unsigned long max_rx_len,
 				       unsigned long *rx_len)
 {
-	struct mpxy_local *mpxy = this_cpu_ptr(&mpxy_local);
+	struct mpxy_local *mpxy;
 	unsigned long rx_bytes;
 	struct sbiret sret;
 
-	if (!mpxy->shmem_active)
-		return -ENODEV;
 	if (!tx && tx_len)
 		return -EINVAL;
 
-	get_cpu();
+	guard(irqsave)();
+
+	mpxy = this_cpu_ptr(&mpxy_local);
+	if (!mpxy->shmem_active)
+		return -ENODEV;
 
 	/* Message protocols allowed to have no data in messages */
 	if (tx_len)
@@ -258,32 +266,31 @@ static int mpxy_send_message_with_resp(u32 channel_id, u32 msg_id,
 			 channel_id, msg_id, tx_len, 0, 0, 0);
 	if (rx && !sret.error) {
 		rx_bytes = sret.value;
-		if (rx_bytes > max_rx_len) {
-			put_cpu();
+		if (rx_bytes > max_rx_len)
 			return -ENOSPC;
-		}
 
 		memcpy(rx, mpxy->shmem, rx_bytes);
 		if (rx_len)
 			*rx_len = rx_bytes;
 	}
 
-	put_cpu();
 	return sbi_err_map_linux_errno(sret.error);
 }
 
 static int mpxy_send_message_without_resp(u32 channel_id, u32 msg_id,
 					  void *tx, unsigned long tx_len)
 {
-	struct mpxy_local *mpxy = this_cpu_ptr(&mpxy_local);
+	struct mpxy_local *mpxy;
 	struct sbiret sret;
 
-	if (!mpxy->shmem_active)
-		return -ENODEV;
 	if (!tx && tx_len)
 		return -EINVAL;
 
-	get_cpu();
+	guard(irqsave)();
+
+	mpxy = this_cpu_ptr(&mpxy_local);
+	if (!mpxy->shmem_active)
+		return -ENODEV;
 
 	/* Message protocols allowed to have no data in messages */
 	if (tx_len)
@@ -292,7 +299,6 @@ static int mpxy_send_message_without_resp(u32 channel_id, u32 msg_id,
 	sret = sbi_ecall(SBI_EXT_MPXY, SBI_EXT_MPXY_SEND_MSG_WITHOUT_RESP,
 			 channel_id, msg_id, tx_len, 0, 0, 0);
 
-	put_cpu();
 	return sbi_err_map_linux_errno(sret.error);
 }
 
@@ -300,32 +306,30 @@ static int mpxy_get_notifications(u32 channel_id,
 				  struct sbi_mpxy_notification_data *notif_data,
 				  unsigned long *events_data_len)
 {
-	struct mpxy_local *mpxy = this_cpu_ptr(&mpxy_local);
+	struct mpxy_local *mpxy;
 	struct sbiret sret;
 
-	if (!mpxy->shmem_active)
-		return -ENODEV;
 	if (!notif_data || !events_data_len)
 		return -EINVAL;
 
-	get_cpu();
+	guard(irqsave)();
+
+	mpxy = this_cpu_ptr(&mpxy_local);
+	if (!mpxy->shmem_active)
+		return -ENODEV;
 
 	sret = sbi_ecall(SBI_EXT_MPXY, SBI_EXT_MPXY_GET_NOTIFICATION_EVENTS,
 			 channel_id, 0, 0, 0, 0, 0);
 	if (sret.error)
-		goto err_put_cpu;
+		return sbi_err_map_linux_errno(sret.error);
 	if (sret.value < 0 || mpxy_shmem_size < sizeof(*notif_data) ||
-	    sret.value > mpxy_shmem_size - sizeof(*notif_data)) {
-		put_cpu();
+	    sret.value > mpxy_shmem_size - sizeof(*notif_data))
 		return -EOVERFLOW;
-	}
 
 	memcpy(notif_data, mpxy->shmem, sret.value + sizeof(*notif_data));
 	*events_data_len = sret.value;
 
-err_put_cpu:
-	put_cpu();
-	return sbi_err_map_linux_errno(sret.error);
+	return 0;
 }
 
 static int mpxy_get_shmem_size(unsigned long *shmem_size)
-- 
2.56.1.911.g883d8bcb20-goog


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 04/10] mailbox: riscv-sbi-mpxy: Validate shmem bounds in message send helpers
  2026-12-03  8:28 [PATCH 00/10] mailbox: Fix Critical and High issues reported by Sashiko Lee Jones
  2026-12-03  8:28 ` [PATCH 03/10] mailbox: riscv-sbi-mpxy: Protect per-CPU shmem access with irqsave Lee Jones
@ 2026-12-03  8:28 ` Lee Jones
  1 sibling, 0 replies; 5+ messages in thread
From: Lee Jones @ 2026-12-03  8:28 UTC (permalink / raw)
  To: lee
  Cc: linux-kernel, stable, Albert Ou, Alexandre Ghiti, Anup Patel,
	Jassi Brar, linux-riscv, Palmer Dabbelt, Paul Walmsley,
	Rahul Pathak

Neither mpxy_send_message_with_resp() nor
mpxy_send_message_without_resp() verifies that tx_len fits within
mpxy_shmem_size before copying into mpxy->shmem.  In addition,
mpxy_send_message_with_resp() checks rx_bytes against max_rx_len but
never verifies that firmware's returned sret.value is non-negative and
within mpxy_shmem_size before copying out of mpxy->shmem.

Reject tx_len > mpxy_shmem_size with -EINVAL in both send helpers, and
reject negative or out-of-bounds sret.value with -EOVERFLOW in
mpxy_send_message_with_resp().

Fixes: bf3022a4eb11 ("mailbox: Add RISC-V SBI message proxy (MPXY) based mailbox driver")
Closes: https://sashiko.dev/#/bug/linux-3c3c0397-a448-41ba-bb19-e7f98ccf265a
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---

Cc: Albert Ou <aou@eecs.berkeley.edu>
Cc: Alexandre Ghiti <alex@ghiti.fr>
Cc: Anup Patel <apatel@ventanamicro.com>
Cc: Jassi Brar <jassisinghbrar@gmail.com>
Cc: linux-riscv@lists.infradead.org
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Paul Walmsley <pjw@kernel.org>
Cc: Rahul Pathak <rahul@summations.net>

 drivers/mailbox/riscv-sbi-mpxy-mbox.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/mailbox/riscv-sbi-mpxy-mbox.c b/drivers/mailbox/riscv-sbi-mpxy-mbox.c
index 90b1972a42ea..8f0af2e3eb94 100644
--- a/drivers/mailbox/riscv-sbi-mpxy-mbox.c
+++ b/drivers/mailbox/riscv-sbi-mpxy-mbox.c
@@ -249,7 +249,7 @@ static int mpxy_send_message_with_resp(u32 channel_id, u32 msg_id,
 	unsigned long rx_bytes;
 	struct sbiret sret;
 
-	if (!tx && tx_len)
+	if ((!tx && tx_len) || tx_len > mpxy_shmem_size)
 		return -EINVAL;
 
 	guard(irqsave)();
@@ -265,6 +265,9 @@ static int mpxy_send_message_with_resp(u32 channel_id, u32 msg_id,
 	sret = sbi_ecall(SBI_EXT_MPXY, SBI_EXT_MPXY_SEND_MSG_WITH_RESP,
 			 channel_id, msg_id, tx_len, 0, 0, 0);
 	if (rx && !sret.error) {
+		if (sret.value < 0 || (unsigned long)sret.value > mpxy_shmem_size)
+			return -EOVERFLOW;
+
 		rx_bytes = sret.value;
 		if (rx_bytes > max_rx_len)
 			return -ENOSPC;
@@ -283,7 +286,7 @@ static int mpxy_send_message_without_resp(u32 channel_id, u32 msg_id,
 	struct mpxy_local *mpxy;
 	struct sbiret sret;
 
-	if (!tx && tx_len)
+	if ((!tx && tx_len) || tx_len > mpxy_shmem_size)
 		return -EINVAL;
 
 	guard(irqsave)();
-- 
2.56.1.911.g883d8bcb20-goog


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 03/10] mailbox: riscv-sbi-mpxy: Protect per-CPU shmem access with irqsave
  2026-12-03  8:28 ` [PATCH 03/10] mailbox: riscv-sbi-mpxy: Protect per-CPU shmem access with irqsave Lee Jones
@ 2026-12-03 14:32   ` Rahul Pathak
  2026-12-03 15:05     ` Lee Jones
  0 siblings, 1 reply; 5+ messages in thread
From: Rahul Pathak @ 2026-12-03 14:32 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-kernel, stable, Albert Ou, Alexandre Ghiti, Anup Patel,
	Jassi Brar, linux-riscv, Palmer Dabbelt, Paul Walmsley,
	Rahul Pathak

On Thu, Dec 3, 2026 at 1:59 PM Lee Jones <lee@kernel.org> wrote:
>
> The SBI MPXY helpers evaluate this_cpu_ptr(&mpxy_local) before calling
> get_cpu(), allowing CPU migration between computing the per-CPU pointer
> and disabling preemption.  They also leave local interrupts enabled
> while using the per-CPU shared memory buffer, allowing a hardirq caller
> (such as mbox_send_message() or mpxy_mbox_msi_write()) to clobber the
> shared memory buffer mid-operation.
>
> Use guard(irqsave)() across all per-CPU shared memory helpers and fetch
> this_cpu_ptr(&mpxy_local) inside the IRQ-disabled section.
>
> Fixes: bf3022a4eb11 ("mailbox: Add RISC-V SBI message proxy (MPXY) based mailbox driver")
> Closes: https://sashiko.dev/#/bug/linux-d2c1eefe-4777-4ad6-94c5-504e347f3add
> Cc: stable@vger.kernel.org
> Signed-off-by: Lee Jones <lee@kernel.org>
> ---
>

This patch is not needed as its being
already taken care by earlier patch sent
but not yet merged -
https://lists.infradead.org/pipermail/linux-riscv/2026-November/104034.html

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 03/10] mailbox: riscv-sbi-mpxy: Protect per-CPU shmem access with irqsave
  2026-12-03 14:32   ` Rahul Pathak
@ 2026-12-03 15:05     ` Lee Jones
  0 siblings, 0 replies; 5+ messages in thread
From: Lee Jones @ 2026-12-03 15:05 UTC (permalink / raw)
  To: Rahul Pathak
  Cc: linux-kernel, stable, Albert Ou, Alexandre Ghiti, Anup Patel,
	Jassi Brar, linux-riscv, Palmer Dabbelt, Paul Walmsley,
	Rahul Pathak

On Thu, 03 Dec 2026, Rahul Pathak wrote:

> On Thu, Dec 3, 2026 at 1:59 PM Lee Jones <lee@kernel.org> wrote:
> >
> > The SBI MPXY helpers evaluate this_cpu_ptr(&mpxy_local) before calling
> > get_cpu(), allowing CPU migration between computing the per-CPU pointer
> > and disabling preemption.  They also leave local interrupts enabled
> > while using the per-CPU shared memory buffer, allowing a hardirq caller
> > (such as mbox_send_message() or mpxy_mbox_msi_write()) to clobber the
> > shared memory buffer mid-operation.
> >
> > Use guard(irqsave)() across all per-CPU shared memory helpers and fetch
> > this_cpu_ptr(&mpxy_local) inside the IRQ-disabled section.
> >
> > Fixes: bf3022a4eb11 ("mailbox: Add RISC-V SBI message proxy (MPXY) based mailbox driver")
> > Closes: https://sashiko.dev/#/bug/linux-d2c1eefe-4777-4ad6-94c5-504e347f3add
> > Cc: stable@vger.kernel.org
> > Signed-off-by: Lee Jones <lee@kernel.org>
> > ---
> >
> 
> This patch is not needed as its being
> already taken care by earlier patch sent
> but not yet merged -
> https://lists.infradead.org/pipermail/linux-riscv/2026-November/104034.html

Noted.  Thanks for letting me know.

-- 
Lee Jones

_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2026-12-03 15:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-03  8:28 [PATCH 00/10] mailbox: Fix Critical and High issues reported by Sashiko Lee Jones
2026-12-03  8:28 ` [PATCH 03/10] mailbox: riscv-sbi-mpxy: Protect per-CPU shmem access with irqsave Lee Jones
2026-12-03 14:32   ` Rahul Pathak
2026-12-03 15:05     ` Lee Jones
2026-12-03  8:28 ` [PATCH 04/10] mailbox: riscv-sbi-mpxy: Validate shmem bounds in message send helpers Lee Jones

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox