From: Arun Iyengar via B4 Relay <devnull+aiyengar1990.gmail.com@kernel.org>
To: Benjamin Gaignard <benjamin.gaignard@collabora.com>,
"Joerg Roedel (AMD)" <joro@8bytes.org>,
Will Deacon <will@kernel.org>,
Robin Murphy <robin.murphy@arm.com>
Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org,
Arun Iyengar <aiyengar1990@gmail.com>,
stable@vger.kernel.org
Subject: [PATCH 2/3] iommu/vsi: Unlink the IOMMU from its old domain under that domain's lock
Date: Sat, 14 Nov 2026 00:14:26 +0000 [thread overview]
Message-ID: <20261114-iommu-vsi-fixes-v1-2-1fc7728dfd35@gmail.com> (raw)
In-Reply-To: <20261114-iommu-vsi-fixes-v1-0-1fc7728dfd35@gmail.com>
From: Arun Iyengar <aiyengar1990@gmail.com>
Attaching a paging domain moves iommu->node to the new domain's list
holding only the new domain's lock. A concurrent map or unmap on the old
domain walks the old list in vsi_iommu_flush_tlb() and can follow the
moved node into the new list.
Unlink the IOMMU under the old domain's lock first.
Fixes: 917ace84b770 ("iommu: Add verisilicon IOMMU driver")
Reported-by: Sashiko <sashiko-bot@kernel.org>
Closes: https://lore.kernel.org/all/sashiko-outbox-206639@kernel.org/
Cc: stable@vger.kernel.org
Signed-off-by: Arun Iyengar <aiyengar1990@gmail.com>
---
drivers/iommu/vsi-iommu.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/vsi-iommu.c b/drivers/iommu/vsi-iommu.c
index 5156e8a2e7fc..8a0f253f2017 100644
--- a/drivers/iommu/vsi-iommu.c
+++ b/drivers/iommu/vsi-iommu.c
@@ -575,12 +575,13 @@ static int vsi_iommu_attach_device(struct iommu_domain *domain,
if (ret < 0)
return ret;
+ vsi_iommu_list_del(iommu);
+
spin_lock_irqsave(&vsi_domain->lock, flags);
spin_lock(&iommu->lock);
vsi_iommu_enable(iommu, domain);
- list_del_init(&iommu->node);
list_add_tail(&iommu->node, &vsi_domain->iommus);
iommu->domain = domain;
--
2.55.0
next prev parent reply other threads:[~2026-11-14 0:14 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-14 0:14 [PATCH 0/3] iommu/vsi: Fix the domain locking and a probe leak Arun Iyengar via B4 Relay
2026-11-14 0:14 ` [PATCH 1/3] iommu/vsi: Don't use the identity domain as a paging domain Arun Iyengar via B4 Relay
2026-11-14 0:14 ` Arun Iyengar via B4 Relay [this message]
2026-11-14 0:14 ` [PATCH 3/3] iommu/vsi: Unprepare the clocks when getting the IRQ fails Arun Iyengar via B4 Relay
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=20261114-iommu-vsi-fixes-v1-2-1fc7728dfd35@gmail.com \
--to=devnull+aiyengar1990.gmail.com@kernel.org \
--cc=aiyengar1990@gmail.com \
--cc=benjamin.gaignard@collabora.com \
--cc=iommu@lists.linux.dev \
--cc=joro@8bytes.org \
--cc=linux-kernel@vger.kernel.org \
--cc=robin.murphy@arm.com \
--cc=stable@vger.kernel.org \
--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
all inboxes | Powered by JetHome®