linux/drivers/iommu
Jason Gunthorpe e946f8e3e6 iommu: Remove useless group refcounting
Several functions obtain the group reference and then release it before
returning. This gives the impression that the refcount is protecting
something for the duration of the function.

In truth all of these functions are called in places that know a device
driver is probed to the device and our locking rules already require
that dev->iommu_group cannot change while a driver is attached to the
struct device.

If this was not the case then this code is already at risk of triggering
UAF as it is racy if the dev->iommu_group is concurrently going to
NULL/free. refcount debugging will throw a WARN if kobject_get() is
called on a 0 refcount object to highlight the bug.

Remove the confusing refcounting and leave behind a comment about the
restriction.

Reviewed-by: Lu Baolu <baolu.lu@linux.intel.com>
Reviewed-by: Kevin Tian <kevin.tian@intel.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
Link: https://lore.kernel.org/r/1-v1-c869a95191f2+5e8-iommu_single_grp_jgg@nvidia.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
2023-09-25 11:45:28 +02:00
..
amd IOMMU Updates for Linux v6.6 2023-09-01 16:54:25 -07:00
arm iommu: Convert simple drivers with DOMAIN_DMA to domain_alloc_paging() 2023-09-25 11:41:04 +02:00
intel IOMMU Updates for Linux v6.6 2023-09-01 16:54:25 -07:00
iommufd iommu: Add IOMMU_DOMAIN_PLATFORM 2023-09-25 11:40:52 +02:00
apple-dart.c iommu/apple-dart: mark apple_dart_pm_ops static 2023-08-07 14:28:06 +02:00
dma-iommu.c iommu: Optimise PCI SAC address trick 2023-07-14 16:14:17 +02:00
dma-iommu.h iommu: Optimise PCI SAC address trick 2023-07-14 16:14:17 +02:00
exynos-iommu.c iommu: Convert simple drivers with DOMAIN_DMA to domain_alloc_paging() 2023-09-25 11:41:04 +02:00
fsl_pamu.c iommu/fsl: fix all kernel-doc warnings in fsl_pamu.c 2023-03-22 14:50:15 +01:00
fsl_pamu.h iommu/fsl_pamu: hardcode the window address and size in pamu_config_ppaace 2021-04-07 10:56:52 +02:00
fsl_pamu_domain.c iommu/fsl_pamu: Implement a PLATFORM domain 2023-09-25 11:40:54 +02:00
fsl_pamu_domain.h iommu/fsl_pamu: remove the snoop_id field 2021-04-07 10:56:52 +02:00
hyperv-iommu.c x86/vector: Rename send_cleanup_vector() to vector_schedule_cleanup() 2023-08-06 14:15:09 +02:00
io-pgfault.c iommu: Rename iommu-sva-lib.{c,h} 2022-11-03 15:47:54 +01:00
io-pgtable-arm-v7s.c iommu/io-pgtable-arm-v7s: Remove map/unmap 2022-11-19 10:44:15 +01:00
io-pgtable-arm.c iommu/io-pgtable-arm: Remove map/unmap 2022-11-19 10:44:15 +01:00
io-pgtable-arm.h iommu/io-pgtable-arm: Move some definitions to a header 2020-09-28 23:48:06 +01:00
io-pgtable-dart.c iommu/io-pgtable-dart: Add DART PTE support for t6000 2022-09-26 13:49:40 +02:00
io-pgtable.c Merge branches 'apple/dart', 'arm/mediatek', 'arm/omap', 'arm/smmu', 'virtio', 'x86/vt-d', 'x86/amd' and 'core' into next 2022-09-26 15:52:31 +02:00
iommu-debugfs.c
iommu-priv.h iommu: Move dev_iommu_ops() to private header 2023-08-18 12:52:15 -03:00
iommu-sva.c iommu: Move global PASID allocation from SVA to core 2023-08-09 17:44:36 +02:00
iommu-sva.h iommu: Remove ioasid infrastructure 2023-03-31 10:03:31 +02:00
iommu-sysfs.c iommu: Do not export iommu_device_link/unlink() 2023-07-14 16:14:15 +02:00
iommu-traces.c iommu: Remove detach_dev callback 2023-01-13 16:39:18 +01:00
iommu.c iommu: Remove useless group refcounting 2023-09-25 11:45:28 +02:00
iova.c iommu/iova: Optimize iova_magazine_alloc() 2023-05-22 17:09:51 +02:00
ipmmu-vmsa.c iommu: Convert simple drivers with DOMAIN_DMA to domain_alloc_paging() 2023-09-25 11:41:04 +02:00
irq_remapping.c x86: Kill all traces of irq_remapping_get_irq_domain() 2020-10-28 20:26:28 +01:00
irq_remapping.h x86: Kill all traces of irq_remapping_get_irq_domain() 2020-10-28 20:26:28 +01:00
Kconfig iommu/tegra-gart: Remove tegra-gart 2023-09-25 11:40:54 +02:00
Makefile iommu/tegra-gart: Remove tegra-gart 2023-09-25 11:40:54 +02:00
msm_iommu.c iommu: Convert remaining simple drivers to domain_alloc_paging() 2023-09-25 11:41:06 +02:00
msm_iommu.h
msm_iommu_hw-8xxx.h
mtk_iommu.c iommu: Convert simple drivers with DOMAIN_DMA to domain_alloc_paging() 2023-09-25 11:41:04 +02:00
mtk_iommu_v1.c iommu: Convert remaining simple drivers to domain_alloc_paging() 2023-09-25 11:41:06 +02:00
of_iommu.c iommu: Have __iommu_probe_device() check for already probed devices 2023-07-14 16:14:12 +02:00
omap-iommu-debug.c iommu/omap: Fix buffer overflow in debugfs 2022-09-07 10:42:28 +02:00
omap-iommu.c iommu: Convert remaining simple drivers to domain_alloc_paging() 2023-09-25 11:41:06 +02:00
omap-iommu.h
omap-iopgtable.h
rockchip-iommu.c iommu: Convert simple drivers with DOMAIN_DMA to domain_alloc_paging() 2023-09-25 11:41:04 +02:00
s390-iommu.c iommu: Convert remaining simple drivers to domain_alloc_paging() 2023-09-25 11:41:06 +02:00
sprd-iommu.c iommu: Convert simple drivers with DOMAIN_DMA to domain_alloc_paging() 2023-09-25 11:41:04 +02:00
sun50i-iommu.c iommu: Convert simple drivers with DOMAIN_DMA to domain_alloc_paging() 2023-09-25 11:41:04 +02:00
tegra-smmu.c iommu: Convert simple drivers with DOMAIN_DMA to domain_alloc_paging() 2023-09-25 11:41:04 +02:00
virtio-iommu.c iommu: Explicitly include correct DT includes 2023-08-21 14:17:59 +02:00