Linux ARM-MSM sub-architecture
 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 01/10] mailbox: qcom-ipcc: Skip of_node_put() on phandle parse failure Lee Jones
  2026-12-03  8:28 ` [PATCH 06/10] mailbox: qcom-ipcc: Remove IRQ domain via devm to avoid ISR use-after-free Lee Jones
  0 siblings, 2 replies; 3+ 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


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

* [PATCH 01/10] mailbox: qcom-ipcc: Skip of_node_put() on phandle parse failure
  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  8:28 ` [PATCH 06/10] mailbox: qcom-ipcc: Remove IRQ domain via devm to avoid ISR use-after-free Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2026-12-03  8:28 UTC (permalink / raw)
  To: lee
  Cc: linux-kernel, stable, Huang Yiwei, Jassi Brar, Kumar Gutta,
	linux-arm-msm, Manivannan Sadhasivam

qcom_ipcc_setup_mbox() declares curr_ph on the stack without
initialising it and unconditionally calls of_node_put(curr_ph.np)
immediately after of_parse_phandle_with_args(), before checking whether
the call succeeded.  If of_parse_phandle_with_args() fails on the first
iteration, of_node_put() dereferences an uninitialised stack pointer;
on subsequent iterations it drops the reference to the previous node a
second time.

Skip the remainder of the loop iteration when
of_parse_phandle_with_args() returns an error, and only release
curr_ph.np on success.

Fixes: e9d50e4b4d04 ("mailbox: qcom-ipcc: Dynamic alloc for channel arrangement")
Closes: https://sashiko.dev/#/bug/linux-2052db5b-c6e1-4da3-aab4-7612dc67c78b
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---

Cc: Huang Yiwei <quic_hyiwei@quicinc.com>
Cc: Jassi Brar <jassisinghbrar@gmail.com>
Cc: Kumar Gutta <vnkgutta@codeaurora.org>
Cc: linux-arm-msm@vger.kernel.org
Cc: Manivannan Sadhasivam <mani@kernel.org>

 drivers/mailbox/qcom-ipcc.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/mailbox/qcom-ipcc.c b/drivers/mailbox/qcom-ipcc.c
index bb54295e03ce..19fea341bd12 100644
--- a/drivers/mailbox/qcom-ipcc.c
+++ b/drivers/mailbox/qcom-ipcc.c
@@ -239,9 +239,12 @@ static int qcom_ipcc_setup_mbox(struct qcom_ipcc *ipcc,
 		for (j = 0; j < i; j++) {
 			ret = of_parse_phandle_with_args(client_dn, "mboxes",
 						"#mbox-cells", j, &curr_ph);
-			of_node_put(curr_ph.np);
-			if (!ret && curr_ph.np == controller_dn)
+			if (ret)
+				continue;
+
+			if (curr_ph.np == controller_dn)
 				ipcc->num_chans++;
+			of_node_put(curr_ph.np);
 		}
 	}
 
-- 
2.56.1.911.g883d8bcb20-goog


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

* [PATCH 06/10] mailbox: qcom-ipcc: Remove IRQ domain via devm to avoid ISR use-after-free
  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 01/10] mailbox: qcom-ipcc: Skip of_node_put() on phandle parse failure Lee Jones
@ 2026-12-03  8:28 ` Lee Jones
  1 sibling, 0 replies; 3+ messages in thread
From: Lee Jones @ 2026-12-03  8:28 UTC (permalink / raw)
  To: lee
  Cc: linux-kernel, stable, Bjorn Andersson, Jassi Brar, Kumar Gutta,
	linux-arm-msm, Manivannan Sadhasivam, Raghavendra Rao Ananta

qcom_ipcc_probe() registers qcom_ipcc_irq_fn() using devm_request_irq(),
but qcom_ipcc_remove() manually removes ipcc->irq_domain before devres
frees the interrupt.  If an interrupt fires during unbind,
qcom_ipcc_irq_fn() dereferences the freed IRQ domain.

Register irq_domain_remove() via devm_add_action_or_reset() immediately
after irq_domain_create_tree() and drop qcom_ipcc_remove() so devres
tears down the IRQ, mailbox controller, and IRQ domain in strict reverse
order.

Fixes: fa74a0257f45 ("mailbox: Add support for Qualcomm IPCC")
Closes: https://sashiko.dev/#/bug/linux-f9f9c7a3-ce00-42b7-9a78-843c2f3712eb
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---

Cc: Bjorn Andersson <andersson@kernel.org>
Cc: Jassi Brar <jassisinghbrar@gmail.com>
Cc: Kumar Gutta <vnkgutta@codeaurora.org>
Cc: linux-arm-msm@vger.kernel.org
Cc: Manivannan Sadhasivam <mani@kernel.org>
Cc: Raghavendra Rao Ananta <rananta@codeaurora.org>

 drivers/mailbox/qcom-ipcc.c | 26 +++++++++++---------------
 1 file changed, 11 insertions(+), 15 deletions(-)

diff --git a/drivers/mailbox/qcom-ipcc.c b/drivers/mailbox/qcom-ipcc.c
index 19fea341bd12..7481f88527d2 100644
--- a/drivers/mailbox/qcom-ipcc.c
+++ b/drivers/mailbox/qcom-ipcc.c
@@ -287,6 +287,11 @@ static int qcom_ipcc_pm_resume(struct device *dev)
 	return 0;
 }
 
+static void qcom_ipcc_irq_domain_remove(void *data)
+{
+	irq_domain_remove(data);
+}
+
 static int qcom_ipcc_probe(struct platform_device *pdev)
 {
 	struct qcom_ipcc *ipcc;
@@ -324,31 +329,23 @@ static int qcom_ipcc_probe(struct platform_device *pdev)
 	if (!ipcc->irq_domain)
 		return -ENOMEM;
 
+	ret = devm_add_action_or_reset(&pdev->dev, qcom_ipcc_irq_domain_remove, ipcc->irq_domain);
+	if (ret)
+		return ret;
+
 	ret = qcom_ipcc_setup_mbox(ipcc, pdev->dev.of_node);
 	if (ret)
-		goto err_mbox;
+		return ret;
 
 	ret = devm_request_irq(&pdev->dev, ipcc->irq, qcom_ipcc_irq_fn,
 			       IRQF_TRIGGER_HIGH | IRQF_NO_SUSPEND |
 			       IRQF_NO_THREAD, dev_name(&pdev->dev), ipcc);
 	if (ret < 0)
-		goto err_mbox;
+		return ret;
 
 	platform_set_drvdata(pdev, ipcc);
 
 	return 0;
-
-err_mbox:
-	irq_domain_remove(ipcc->irq_domain);
-
-	return ret;
-}
-
-static void qcom_ipcc_remove(struct platform_device *pdev)
-{
-	struct qcom_ipcc *ipcc = platform_get_drvdata(pdev);
-
-	irq_domain_remove(ipcc->irq_domain);
 }
 
 static const struct of_device_id qcom_ipcc_of_match[] = {
@@ -363,7 +360,6 @@ static const struct dev_pm_ops qcom_ipcc_dev_pm_ops = {
 
 static struct platform_driver qcom_ipcc_driver = {
 	.probe = qcom_ipcc_probe,
-	.remove = qcom_ipcc_remove,
 	.driver = {
 		.name = "qcom-ipcc",
 		.of_match_table = qcom_ipcc_of_match,
-- 
2.56.1.911.g883d8bcb20-goog


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

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

Thread overview: 3+ 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 01/10] mailbox: qcom-ipcc: Skip of_node_put() on phandle parse failure Lee Jones
2026-12-03  8:28 ` [PATCH 06/10] mailbox: qcom-ipcc: Remove IRQ domain via devm to avoid ISR use-after-free Lee Jones

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