From: Nicolin Chen <nicolinc@nvidia.com>
To: <will@kernel.org>
Cc: <thierry.reding@gmail.com>, <vdumpa@nvidia.com>,
<robin.murphy@arm.com>, <joro@8bytes.org>, <jonathanh@nvidia.com>,
<jgg@nvidia.com>, <linux-tegra@vger.kernel.org>,
<linux-arm-kernel@lists.infradead.org>, <iommu@lists.linux.dev>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH rc 2/2] iommu/tegra241-cmdqv: Fix UAF due to re-entry of tegra241_cmdqv_remove()
Date: Mon, 7 Apr 2025 11:51:20 -0700 [thread overview]
Message-ID: <Z/QeqJqXJZSSPekL@nvidia.com> (raw)
In-Reply-To: <b3cebee623b4c3fc7de0aa2abcb703b9342ba33d.1744014481.git.nicolinc@nvidia.com>
On Mon, Apr 07, 2025 at 01:35:00AM -0700, Nicolin Chen wrote:
> When falling back to standard SMMU CMDQ, impl_ops must be set to NULL, so
> tegra241_cmdqv_remove() will not be re-entered by arm_smmu_impl_remove(),
> which will trigger a UAF.
>
> Fixes: 483e0bd8883a ("iommu/tegra241-cmdqv: Do not allocate vcmdq until dma_set_mask_and_coherent")
> Cc: stable@vger.kernel.org
> Signed-off-by: Nicolin Chen <nicolinc@nvidia.com>
> ---
> drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c b/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c
> index ce7be8eeb43c..8249ef087af3 100644
> --- a/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c
> +++ b/drivers/iommu/arm/arm-smmu-v3/tegra241-cmdqv.c
> @@ -803,6 +803,7 @@ static int tegra241_cmdqv_init_structures(struct arm_smmu_device *smmu)
> dev_info(smmu->impl_dev, "Falling back to standard SMMU CMDQ\n");
> smmu->options &= ~ARM_SMMU_OPT_TEGRA241_CMDQV;
> tegra241_cmdqv_remove(smmu);
> + smmu->impl_ops = NULL;
> return 0;
Per discussion in the other patch, with a v2 this whole rewind
part would be dropped to ask SMMU driver to fail and then call
tegra241_cmdqv_remove() via smmu->impl_ops->device_remove().
So we wouldn't need this patch after all.
Thanks
Nicolin
prev parent reply other threads:[~2025-04-07 18:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-07 8:34 [PATCH rc 0/2] iommu/tegra241-cmdqv: Two bug fixes in fallback routine Nicolin Chen
2025-04-07 8:34 ` [PATCH rc 1/2] iommu/tegra241-cmdqv: Fix warnings due to dmam_free_coherent() Nicolin Chen
2025-04-07 17:44 ` Jason Gunthorpe
2025-04-07 18:46 ` Nicolin Chen
2025-04-07 8:35 ` [PATCH rc 2/2] iommu/tegra241-cmdqv: Fix UAF due to re-entry of tegra241_cmdqv_remove() Nicolin Chen
2025-04-07 17:45 ` Jason Gunthorpe
2025-04-07 18:51 ` Nicolin Chen [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=Z/QeqJqXJZSSPekL@nvidia.com \
--to=nicolinc@nvidia.com \
--cc=iommu@lists.linux.dev \
--cc=jgg@nvidia.com \
--cc=jonathanh@nvidia.com \
--cc=joro@8bytes.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=thierry.reding@gmail.com \
--cc=vdumpa@nvidia.com \
--cc=will@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;
as well as URLs for NNTP newsgroup(s).