From: Lee Jones <lee@kernel.org>
To: lee@kernel.org
Cc: linux-kernel@vger.kernel.org, stable@vger.kernel.org,
Jassi Brar <jassisinghbrar@gmail.com>,
Sudeep Holla <sudeep.holla@kernel.org>
Subject: [PATCH 09/10] mailbox: arm_mhu_db: Initialise channel registers before controller registration
Date: Thu, 3 Dec 2026 08:28:09 +0000 [thread overview]
Message-ID: <248005d026eba0c9fae441bf8032588ba85dc2b6.1796286447.git.lee@kernel.org> (raw)
In-Reply-To: <cover.1796286447.git.lee@kernel.org>
mhu_db_probe() registers the mailbox controller via
devm_mbox_controller_register() before populating mhu->mlink[].irq,
rx_reg, and tx_reg. A client binding immediately after controller
registration can therefore dereference NULL rx_reg or tx_reg pointers
in mhu_db_startup() or mhu_db_send_data().
Populate mhu->mlink[].irq, rx_reg, and tx_reg before calling
devm_mbox_controller_register(), while keeping
devm_request_threaded_irq() after registration so devres continues to
free all IRQs before unregistering the controller on unbind or probe
failure.
Fixes: 7002ca237b21 ("mailbox: arm_mhu: Add ARM MHU doorbell driver")
Closes: https://sashiko.dev/#/bug/linux-2f1b809f-5c0c-4cd3-b99e-53265de37a3f
Cc: stable@vger.kernel.org
Signed-off-by: Lee Jones <lee@kernel.org>
---
Cc: Jassi Brar <jassisinghbrar@gmail.com>
Cc: Sudeep Holla <sudeep.holla@kernel.org>
drivers/mailbox/arm_mhu_db.c | 19 +++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)
diff --git a/drivers/mailbox/arm_mhu_db.c b/drivers/mailbox/arm_mhu_db.c
index 9f1c7bcfdcb4..c825f4ec43cf 100644
--- a/drivers/mailbox/arm_mhu_db.c
+++ b/drivers/mailbox/arm_mhu_db.c
@@ -297,12 +297,6 @@ static int mhu_db_probe(struct amba_device *adev, const struct amba_id *id)
mhu->mbox.ops = &mhu_db_ops;
- err = devm_mbox_controller_register(dev, &mhu->mbox);
- if (err) {
- dev_err(dev, "Failed to register mailboxes %d\n", err);
- return err;
- }
-
for (i = 0; i < MHU_CHANS; i++) {
int irq = mhu->mlink[i].irq = adev->irq[i];
@@ -313,6 +307,19 @@ static int mhu_db_probe(struct amba_device *adev, const struct amba_id *id)
mhu->mlink[i].rx_reg = mhu->base + mhu_reg[i];
mhu->mlink[i].tx_reg = mhu->mlink[i].rx_reg + TX_REG_OFFSET;
+ }
+
+ err = devm_mbox_controller_register(dev, &mhu->mbox);
+ if (err) {
+ dev_err(dev, "Failed to register mailboxes %d\n", err);
+ return err;
+ }
+
+ for (i = 0; i < MHU_CHANS; i++) {
+ int irq = mhu->mlink[i].irq;
+
+ if (irq <= 0)
+ continue;
err = devm_request_threaded_irq(dev, irq, NULL,
mhu_db_mbox_rx_handler,
--
2.56.1.911.g883d8bcb20-goog
next prev parent reply other threads:[~2026-12-03 8:28 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
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 10:38 ` Konrad Dybcio
2026-12-03 8:28 ` [PATCH 02/10] mailbox: ti-msgmgr: Use unsigned IDs in ti_msgmgr_of_xlate() 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
2026-12-03 8:28 ` [PATCH 05/10] mailbox: bcm-pdc: Unregister mailbox controller before destroying DMA pools 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
2026-12-03 10:39 ` Konrad Dybcio
2026-12-03 8:28 ` [PATCH 07/10] mailbox: sun6i-msgbox: Free IRQ before disabling clock on teardown Lee Jones
2026-12-03 13:43 ` Chen-Yu Tsai
2026-12-03 8:28 ` [PATCH 08/10] mailbox: sun6i-msgbox: Synchronise IRQ during channel shutdown Lee Jones
2026-12-03 13:49 ` Chen-Yu Tsai
2026-12-03 8:28 ` Lee Jones [this message]
2026-12-03 9:40 ` [PATCH 09/10] mailbox: arm_mhu_db: Initialise channel registers before controller registration Sudeep Holla
2026-12-03 8:28 ` [PATCH 10/10] mailbox: ti-msgmgr: Return -EIO on queue error in ti_msgmgr_send_data() Lee Jones
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=248005d026eba0c9fae441bf8032588ba85dc2b6.1796286447.git.lee@kernel.org \
--to=lee@kernel.org \
--cc=jassisinghbrar@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=stable@vger.kernel.org \
--cc=sudeep.holla@kernel.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
all inboxes | Powered by JetHome®