* [PATCH 0/2] mailbox: tegra-hsp: Reject duplicate mailbox clients
@ 2026-12-03 8:33 Jiangtian Feng
2026-12-03 8:33 ` [PATCH 1/2] mailbox: tegra-hsp: Reject duplicate doorbell clients Jiangtian Feng
2026-12-03 8:33 ` [PATCH 2/2] mailbox: tegra-hsp: Reject duplicate shared mailbox clients Jiangtian Feng
0 siblings, 2 replies; 3+ messages in thread
From: Jiangtian Feng @ 2026-12-03 8:33 UTC (permalink / raw)
To: jassisinghbrar
Cc: thierry.reding, jonathanh, linux-kernel, linux-tegra,
Jiangtian Feng
These two small patches prevent a repeated mailbox request from changing
the state of an active client.
The doorbell patch rejects a duplicate request while chan->cl is live.
Using the client pointer rather than the channel pointer alone preserves
retries after a failed startup while keeping exclusive ownership during
normal use.
The shared mailbox patch rejects an occupied channel before changing
mb->ops or mb->producer, preserving the original client's direction,
width and interrupt mask.
The failed-startup channel-slot lifetime issue is pre-existing and is
intentionally outside this small series.
Validation:
- Independent static review found no High/Medium issues.
- W=1 tegra-hsp.o builds after each patch.
- Complete ARM64 Image build; size 44,833,280 bytes, SHA-256
f972a099b2da6e801c41d25558c3803af604bdbb1113adfdeda931b6e94e0d28.
- Fixes tags were verified against full repository history.
- Final patches have no checkpatch warnings; only the submitter's DCO
sign-off is pending.
NOT_RUN:
- Repeated client, BPMP, startup failure/rebind and IRQ runtime testing.
- NOIRQ suspend/resume and hardware fault injection.
Jiangtian Feng (2):
mailbox: tegra-hsp: Reject duplicate doorbell clients
mailbox: tegra-hsp: Reject duplicate shared mailbox clients
drivers/mailbox/tegra-hsp.c | 9 +++++++++
1 file changed, 9 insertions(+)
--
2.47.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] mailbox: tegra-hsp: Reject duplicate doorbell clients
2026-12-03 8:33 [PATCH 0/2] mailbox: tegra-hsp: Reject duplicate mailbox clients Jiangtian Feng
@ 2026-12-03 8:33 ` Jiangtian Feng
2026-12-03 8:33 ` [PATCH 2/2] mailbox: tegra-hsp: Reject duplicate shared mailbox clients Jiangtian Feng
1 sibling, 0 replies; 3+ messages in thread
From: Jiangtian Feng @ 2026-12-03 8:33 UTC (permalink / raw)
To: jassisinghbrar
Cc: thierry.reding, jonathanh, linux-kernel, linux-tegra,
Jiangtian Feng
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@linux.alibaba.com>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] mailbox: tegra-hsp: Reject duplicate shared mailbox clients
2026-12-03 8:33 [PATCH 0/2] mailbox: tegra-hsp: Reject duplicate mailbox clients Jiangtian Feng
2026-12-03 8:33 ` [PATCH 1/2] mailbox: tegra-hsp: Reject duplicate doorbell clients Jiangtian Feng
@ 2026-12-03 8:33 ` Jiangtian Feng
1 sibling, 0 replies; 3+ messages in thread
From: Jiangtian Feng @ 2026-12-03 8:33 UTC (permalink / raw)
To: jassisinghbrar
Cc: thierry.reding, jonathanh, linux-kernel, linux-tegra,
Jiangtian Feng
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@linux.alibaba.com>
---
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-12-03 8:33 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:33 [PATCH 0/2] mailbox: tegra-hsp: Reject duplicate mailbox clients Jiangtian Feng
2026-12-03 8:33 ` [PATCH 1/2] mailbox: tegra-hsp: Reject duplicate doorbell clients Jiangtian Feng
2026-12-03 8:33 ` [PATCH 2/2] mailbox: tegra-hsp: Reject duplicate shared mailbox clients Jiangtian Feng
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox