1
0
Fork 0
alistair23-linux/drivers/iommu
Marc Zyngier 77abae8657 iommu/dma: Fix MSI reservation allocation
commit 65ac74f1de upstream.

The way cookie_init_hw_msi_region() allocates the iommu_dma_msi_page
structures doesn't match the way iommu_put_dma_cookie() frees them.

The former performs a single allocation of all the required structures,
while the latter tries to free them one at a time. It doesn't quite
work for the main use case (the GICv3 ITS where the range is 64kB)
when the base granule size is 4kB.

This leads to a nice slab corruption on teardown, which is easily
observable by simply creating a VF on a SRIOV-capable device, and
tearing it down immediately (no need to even make use of it).
Fortunately, this only affects systems where the ITS isn't translated
by the SMMU, which are both rare and non-standard.

Fix it by allocating iommu_dma_msi_page structures one at a time.

Fixes: 7c1b058c8b ("iommu/dma: Handle IOMMU API reserved regions")
Signed-off-by: Marc Zyngier <maz@kernel.org>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Cc: Robin Murphy <robin.murphy@arm.com>
Cc: Joerg Roedel <jroedel@suse.de>
Cc: Will Deacon <will@kernel.org>
Cc: stable@vger.kernel.org
Reviewed-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-03-18 07:17:54 +01:00
..
Kconfig ia64 for v5.4 - big change here is removal of support for SGI Altix 2019-09-16 15:32:01 -07:00
Makefile Merge branches 'arm/omap', 'arm/exynos', 'arm/smmu', 'arm/mediatek', 'arm/qcom', 'arm/renesas', 'x86/amd', 'x86/vt-d' and 'core' into next 2019-09-11 12:39:19 +02:00
amd_iommu.c PCI: Add nr_devfns parameter to pci_add_dma_alias() 2020-02-24 08:36:37 +01:00
amd_iommu.h iommu/amd: Override wrong IVRS IOAPIC on Raven Ridge systems 2019-08-23 10:26:48 +02:00
amd_iommu_debugfs.c iommu/amd: Add basic debugfs infrastructure for AMD IOMMU 2018-07-06 14:06:30 +02:00
amd_iommu_init.c iommu/amd: Disable IOMMU on Stoney Ridge systems 2020-03-12 13:00:14 +01:00
amd_iommu_proto.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 333 2019-06-05 17:37:06 +02:00
amd_iommu_quirks.c iommu/amd: Apply the same IVRS IOAPIC workaround to Acer Aspire A315-41 2019-10-30 10:24:03 +01:00
amd_iommu_types.h iommu/amd: Only support x2APIC with IVHD type 11h/40h 2020-02-24 08:36:40 +01:00
amd_iommu_v2.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 333 2019-06-05 17:37:06 +02:00
arm-smmu-impl.c iommu/arm-smmu: Make private implementation details static 2019-08-20 10:58:03 +01:00
arm-smmu-v3.c iommu/arm-smmu-v3: Use WRITE_ONCE() when changing validity of an STE 2020-02-24 08:36:49 +01:00
arm-smmu.c iommu/arm-smmu: Free context bitmap in the err path of arm_smmu_init_domain_context 2019-10-01 12:13:16 +01:00
arm-smmu.h Merge branches 'for-joerg/arm-smmu/smmu-v2' and 'for-joerg/arm-smmu/smmu-v3' into for-joerg/arm-smmu/updates 2019-08-23 15:05:45 +01:00
dma-iommu.c iommu/dma: Fix MSI reservation allocation 2020-03-18 07:17:54 +01:00
dmar.c iommu/vt-d: Remove unnecessary WARN_ON_ONCE() 2020-02-24 08:36:57 +01:00
exynos-iommu.c Merge branches 'arm/omap', 'arm/exynos', 'arm/smmu', 'arm/mediatek', 'arm/qcom', 'arm/renesas', 'x86/amd', 'x86/vt-d' and 'core' into next 2019-09-11 12:39:19 +02:00
fsl_pamu.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
fsl_pamu.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
fsl_pamu_domain.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
fsl_pamu_domain.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 266 2019-06-05 17:30:28 +02:00
hyperv-iommu.c iommu/hyper-v: Add Hyper-V stub IOMMU driver 2019-02-28 11:12:16 +01:00
intel-iommu-debugfs.c iommu/vt-d: Correctly check format of page table in debugfs 2019-08-09 17:29:25 +02:00
intel-iommu.c iommu/vt-d: quirk_ioat_snb_local_iommu: replace WARN_TAINT with pr_warn + add_taint 2020-03-18 07:17:49 +01:00
intel-pasid.c iommu/vt-d: Match CPU and IOMMU paging mode 2020-02-24 08:36:43 +01:00
intel-pasid.h iommu/vt-d: Introduce macros useful for dumping DMAR table 2019-05-27 16:16:09 +02:00
intel-svm.c iommu/vt-d: Avoid sending invalid page response 2020-02-24 08:36:43 +01:00
intel-trace.c iommu/vt-d: Add trace events for device dma map/unmap 2019-09-11 12:34:30 +02:00
intel_irq_remapping.c iommu/vt-d: Fix wrong analysis whether devices share the same bus 2019-08-30 15:47:37 +02:00
io-pgtable-arm-v7s.c Merge branch 'arm/smmu' into arm/mediatek 2019-08-30 16:12:10 +02:00
io-pgtable-arm.c iommu/io-pgtable-arm: Support all Mali configurations 2019-10-01 12:16:47 +01:00
io-pgtable.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234 2019-06-19 17:09:07 +02:00
iommu-debugfs.c iommu: Fix IOMMU debugfs fallout 2019-02-26 11:15:58 +01:00
iommu-sysfs.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
iommu-traces.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
iommu.c iommu: Remove device link to group on failure 2020-01-17 19:48:20 +01:00
iova.c iommu/iova: Silence warnings under memory pressure 2020-02-24 08:36:40 +01:00
ipmmu-vmsa.c iommu/ipmmu-vmsa: Remove dev_err() on platform_get_irq() failure 2019-10-30 10:16:37 +01:00
irq_remapping.c treewide: Add SPDX license identifier for missed files 2019-05-21 10:50:45 +02:00
irq_remapping.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 333 2019-06-05 17:37:06 +02:00
msm_iommu.c Merge branch 'for-joerg/batched-unmap' of git://git.kernel.org/pub/scm/linux/kernel/git/will/linux into core 2019-08-20 11:09:43 +02:00
msm_iommu.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 267 2019-06-05 17:30:29 +02:00
msm_iommu_hw-8xxx.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 267 2019-06-05 17:30:29 +02:00
mtk_iommu.c iommu/mediatek: Add a new tlb_lock for tlb_flush 2020-01-17 19:48:59 +01:00
mtk_iommu.h iommu/mediatek: Add a new tlb_lock for tlb_flush 2020-01-17 19:48:59 +01:00
mtk_iommu_v1.c Devicetree updates for v5.4: 2019-09-19 13:48:37 -07:00
of_iommu.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 335 2019-06-05 17:37:06 +02:00
omap-iommu-debug.c Merge branches 'x86/vt-d', 'x86/amd', 'arm/smmu', 'arm/omap', 'generic-dma-ops' and 'core' into next 2019-07-04 17:26:48 +02:00
omap-iommu.c Merge branches 'arm/omap', 'arm/exynos', 'arm/smmu', 'arm/mediatek', 'arm/qcom', 'arm/renesas', 'x86/amd', 'x86/vt-d' and 'core' into next 2019-09-11 12:39:19 +02:00
omap-iommu.h iommu/omap: add support for late attachment of iommu devices 2019-08-09 17:37:10 +02:00
omap-iopgtable.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
qcom_iommu.c iommu/qcom: Fix bogus detach logic 2020-02-28 17:22:12 +01:00
rockchip-iommu.c iommu: rockchip: Free domain on .domain_free 2020-01-04 19:16:38 +01:00
s390-iommu.c iommu: Pass struct iommu_iotlb_gather to ->unmap() and ->iotlb_sync() 2019-07-29 17:22:52 +01:00
tegra-gart.c iommu: Pass struct iommu_iotlb_gather to ->unmap() and ->iotlb_sync() 2019-07-29 17:22:52 +01:00
tegra-smmu.c iommu/tegra-smmu: Fix page tables in > 4 GiB memory 2020-01-04 19:16:39 +01:00
virtio-iommu.c Merge branch 'for-joerg/arm-smmu/updates' of git://git.kernel.org/pub/scm/linux/kernel/git/will/linux into arm/smmu 2019-08-23 17:41:59 +02:00