[PATCH 1/2] mailbox: tegra-hsp: Reject duplicate doorbell clients

From: Jiangtian Feng

Date: Thu Dec 03 2026 - 03:34:03 EST


tegra_hsp_db_xlate() overwrites db->channel.chan for each request. A
second client for the same master can replace an active binding, leaving
the original client with corrupted IRQ state and allowing callbacks
before the new client is installed.

Reject requests while the doorbell has a live client. Checking chan->cl
rather than the channel pointer alone preserves retries after a failed
startup while keeping exclusive ownership during normal use.

Qoder, an AI coding assistant, helped analyze the duplicate-binding
failure mode and draft this change and description. The submitter
reviewed the change and is responsible for final validation.

Fixes: 0fe88461a0ec ("mailbox: Add Tegra HSP driver")
Signed-off-by: Jiangtian Feng <jiangtianfeng@xxxxxxxxxxxxxxxxx>
---
drivers/mailbox/tegra-hsp.c | 6 ++++++
1 file changed, 6 insertions(+)

diff --git a/drivers/mailbox/tegra-hsp.c b/drivers/mailbox/tegra-hsp.c
index 1f6215c7e498..b1ea2beeaf8b 100644
--- a/drivers/mailbox/tegra-hsp.c
+++ b/drivers/mailbox/tegra-hsp.c
@@ -608,6 +608,12 @@ static struct mbox_chan *tegra_hsp_db_xlate(struct mbox_controller *mbox,

spin_lock_irqsave(&hsp->lock, flags);

+ /* A failed startup has no live client and may be retried. */
+ if (channel->chan && channel->chan->cl) {
+ spin_unlock_irqrestore(&hsp->lock, flags);
+ return ERR_PTR(-EBUSY);
+ }
+
for (i = 0; i < mbox->num_chans; i++) {
chan = &mbox->chans[i];
if (!chan->con_priv) {
--
2.47.3