From: Jiangtian Feng <jiangtianfeng@linux.alibaba.com>
To: jassisinghbrar@gmail.com
Cc: thierry.reding@kernel.org, jonathanh@nvidia.com,
linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org,
Jiangtian Feng <jiangtianfeng@linux.alibaba.com>
Subject: [PATCH 1/2] mailbox: tegra-hsp: Reject duplicate doorbell clients
Date: Thu, 3 Dec 2026 16:33:29 +0800 [thread overview]
Message-ID: <20261203083330.3300442-2-jiangtianfeng@linux.alibaba.com> (raw)
In-Reply-To: <20261203083330.3300442-1-jiangtianfeng@linux.alibaba.com>
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
next prev parent reply other threads:[~2026-12-03 8:33 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-03 8:33 [PATCH 0/2] mailbox: tegra-hsp: Reject duplicate mailbox clients Jiangtian Feng
2026-12-03 8:33 ` Jiangtian Feng [this message]
2026-12-03 8:33 ` [PATCH 2/2] mailbox: tegra-hsp: Reject duplicate shared " Jiangtian Feng
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=20261203083330.3300442-2-jiangtianfeng@linux.alibaba.com \
--to=jiangtianfeng@linux.alibaba.com \
--cc=jassisinghbrar@gmail.com \
--cc=jonathanh@nvidia.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=thierry.reding@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