diff options
| author | Peiyang He <peiyang_he@smail.nju.edu.cn> | 2026-11-06 19:52:52 +0800 |
|---|---|---|
| committer | Jason Gunthorpe <jgg@nvidia.com> | 2026-11-10 17:24:15 -0400 |
| commit | a12337013fcaf6eea29dce8409b84bd4588f7801 (patch) | |
| tree | 35d28885ce5fca536b3b7789cc5183b53d600cf9 /scripts/Makefile.thinlto | |
| parent | e6c489f40f10cc80b9baee3e6b59682bd26f3c60 (diff) | |
| download | linux-next-a12337013fcaf6eea29dce8409b84bd4588f7801.tar.gz linux-next-a12337013fcaf6eea29dce8409b84bd4588f7801.zip | |
iommufd/selftest: Fix leaked PASIDs on device teardown
The selftest mock device teardown only detaches IOMMU_NO_PASID.
If userspace attaches a non-default PASID with IOMMU_TEST_OP_PASID_ATTACH
and never issues IOMMU_TEST_OP_PASID_DETACH, the attachment keeps the
reference taken by iommufd_device_attach(). Unbind then fails and the
iommufd device and IOMMU group are leaked, triggering:
WARNING: drivers/iommu/iommufd/iommufd_private.h:241 at iommufd_device_unbind+0x80/0xb0
WARNING: drivers/iommu/iommu.c:744 at __iommu_group_free_device+0x1b2/0x400
WARNING: drivers/iommu/iommufd/main.c:389 at iommufd_fops_release+0x380/0x3b0
WARNING: drivers/iommu/iommufd/main.c:399 at iommufd_fops_release+0x3a3/0x3b0
Track attached PASIDs in an IDA, as VFIO does, and detach them all
before detaching IOMMU_NO_PASID and unbinding the mock device.
Fixes: c1b52b0a97ae ("iommufd/selftest: Add test ops to test pasid attach/detach")
Signed-off-by: Peiyang He <peiyang_he@smail.nju.edu.cn>
Link: https://patch.msgid.link/CD846EC67F4302A7+20261106115252.87749-1-peiyang_he@smail.nju.edu.cn
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Diffstat (limited to 'scripts/Makefile.thinlto')
0 files changed, 0 insertions, 0 deletions
