From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=115.124.30.99 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796286838; b=3Cs4Vq+aJTPG6V1pyRmtVTdtJGCRPCq3hnJch0bfoBka1m6YIPq93VXnNYs3iK4BDhK9 BFbNgYe33IUzSc1VV5c1zCJDLdgjTwjZf0t8bMDdqT6dJPBvuVf+sq7r3POQ9Rj6Oz1T7 I3GaWJ3NfzsV6paGBVdn/kS4jPaSLKhZYKmTnsMYkN5piTZV12Nodob6EWGrY0b1lMBMK wXi7GZhEQRmDhK3brGEnzYJBmhJC2iCvEyTai3ewcZTvCSBziVG4fP8r579i2onClTUvM Nd06Nde24zWSsaMfNBmiM8ikpUc/0ffzJfZF68OWUFs5N4straKTfGMhMahDrPXtzdg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796286838; h=DMARC-Filter:DKIM-Signature:X-Alimail-AntiSpam:Received:From:To:Cc: Subject:Date:Message-ID:X-Mailer:In-Reply-To:References:MIME-Version: Content-Transfer-Encoding; bh=CLg93UKxkoxSvI2/nsmX4VXtyQ51ttgXadAqY4Y+zWA=; b=5mgAeT/Q5+o+qBOMUlbR37uL2udnF8E7lSRmAfha8+1SW0vmO20+wnBKUMzQj3OqUuB2 MjmzZqRAFo48o45aixxAqA1vSGlHMG1FvXTFdOijCXOPVYBUtuIlPnh6VdQ7GQECO7Icr w3bpuJU/9SvV/6DVAs4x/cYfTja2TjqqiHRrorHjQp9jX3Cm1K6If7jr1l+sIbJ1aoaMV UlUN2+fRcUlHRexAxCGXmK0eY57QaO/TZFufPhmT0zK3RKPY5Xebo310twLiZZLtQ105C PaAcnxu+3QYzoyRfvnSIMqSoOb2jXsr6fVJOe47YRaRziPXjjetG1gQ5v28jhp7/lLA== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=linux.alibaba.com; spf=pass smtp.mailfrom=linux.alibaba.com; dkim=pass header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=hdsDIqXW; arc=none smtp.remote-ip=115.124.30.99 Received: from out30-99.freemail.mail.aliyun.com (out30-99.freemail.mail.aliyun.com [115.124.30.99]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id EC92D606A32D; Thu, 3 Dec 2026 08:33:56 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org EC92D606A32D Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.alibaba.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.alibaba.com header.i=@linux.alibaba.com header.a=rsa-sha256 header.s=default header.b=hdsDIqXW DKIM-Signature:v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.alibaba.com; s=default; t=1796286827; h=From:To:Subject:Date:Message-ID:MIME-Version; bh=CLg93UKxkoxSvI2/nsmX4VXtyQ51ttgXadAqY4Y+zWA=; b=hdsDIqXWXM3yp8QpG7aakfgZsJxVFm1rJ8DcqJ4UBYDj4GYqKfVbL3+PjBBGaDbBrVbajZChEM96p9Ahg7keGFhQewXlfOowwgefoQ6B8KvXFr1d8QCcP2JA5JrNm+fgDSEjA7OhEAlYtjejumTPGptr+3WTkOgNO5z2uFKlkWI= X-Alimail-AntiSpam:AC=PASS;BC=-1|-1;BR=01201311R121e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=maildocker-contentspam033071064103;MF=jiangtianfeng@linux.alibaba.com;NM=1;PH=DS;RN=6;SR=0;TI=SMTPD_---0XGDVotN_1796286826; Received: from h68d07384.sqa.eu95.tbsite.net(mailfrom:jiangtianfeng@linux.alibaba.com fp:SMTPD_---0XGDVotN_1796286826 cluster:ay36) by smtp.aliyun-inc.com; Thu, 03 Dec 2026 16:33:47 +0800 From: Jiangtian Feng To: jassisinghbrar@gmail.com Cc: thierry.reding@kernel.org, jonathanh@nvidia.com, linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, Jiangtian Feng Subject: [PATCH 2/2] mailbox: tegra-hsp: Reject duplicate shared mailbox clients Date: Thu, 3 Dec 2026 16:33:30 +0800 Message-ID: <20261203083330.3300442-3-jiangtianfeng@linux.alibaba.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20261203083330.3300442-1-jiangtianfeng@linux.alibaba.com> References: <20261203083330.3300442-1-jiangtianfeng@linux.alibaba.com> X-Mailing-List: linux-tegra@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 --- 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