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 2/2] mailbox: tegra-hsp: Reject duplicate shared mailbox clients
Date: Thu, 3 Dec 2026 16:33:30 +0800 [thread overview]
Message-ID: <20261203083330.3300442-3-jiangtianfeng@linux.alibaba.com> (raw)
In-Reply-To: <20261203083330.3300442-1-jiangtianfeng@linux.alibaba.com>
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
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 ` [PATCH 1/2] mailbox: tegra-hsp: Reject duplicate doorbell clients Jiangtian Feng
2026-12-03 8:33 ` Jiangtian Feng [this message]
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-3-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