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

From: Jiangtian Feng

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


A repeated request for an occupied shared mailbox changes mb->ops and
mb->producer before mailbox core rejects it. The original client can
then use the wrong direction or width, and shutdown may mask the wrong
interrupt bit.

Reject an occupied shared mailbox before changing any of its state.
The check is serialized by mailbox core's con_mutex, and a failed or
normal release still allows a later request.

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: 91b1b1c3da8a ("mailbox: tegra-hsp: Add support for shared mailboxes")
Signed-off-by: Jiangtian Feng <jiangtianfeng@xxxxxxxxxxxxxxxxx>
---
drivers/mailbox/tegra-hsp.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/mailbox/tegra-hsp.c b/drivers/mailbox/tegra-hsp.c
index b1ea2beeaf8b..7902af16433c 100644
--- a/drivers/mailbox/tegra-hsp.c
+++ b/drivers/mailbox/tegra-hsp.c
@@ -645,6 +645,9 @@ static struct mbox_chan *tegra_hsp_sm_xlate(struct mbox_controller *mbox,

mb = &hsp->mailboxes[index];

+ if (mb->channel.chan->cl)
+ return ERR_PTR(-EBUSY);
+
if (type & TEGRA_HSP_MBOX_TYPE_SM_128BIT) {
if (!hsp->soc->has_128_bit_mb)
return ERR_PTR(-ENODEV);
--
2.47.3