android_kernel_samsung_a7y1.../drivers/iommu
Daniel Drake 744dc29fb6 iommu/vt-d: Ignore devices with out-of-spec domain number
commit da72a379b2ec0bad3eb265787f7008bead0b040c upstream.

VMD subdevices are created with a PCI domain ID of 0x10000 or
higher.

These subdevices are also handled like all other PCI devices by
dmar_pci_bus_notifier().

However, when dmar_alloc_pci_notify_info() take records of such devices,
it will truncate the domain ID to a u16 value (in info->seg).
The device at (e.g.) 10000:00:02.0 is then treated by the DMAR code as if
it is 0000:00:02.0.

In the unlucky event that a real device also exists at 0000:00:02.0 and
also has a device-specific entry in the DMAR table,
dmar_insert_dev_scope() will crash on:
   BUG_ON(i >= devices_cnt);

That's basically a sanity check that only one PCI device matches a
single DMAR entry; in this case we seem to have two matching devices.

Fix this by ignoring devices that have a domain number higher than
what can be looked up in the DMAR table.

This problem was carefully diagnosed by Jian-Hong Pan.

Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com>
Signed-off-by: Daniel Drake <drake@endlessm.com>
Fixes: 59ce0515cdaf3 ("iommu/vt-d: Update DRHD/RMRR/ATSR device scope caches when PCI hotplug happens")
Signed-off-by: Joerg Roedel <jroedel@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-07 14:11:55 +02:00
..
amd_iommu_init.c iommu/amd: Make iommu_disable safer 2020-04-07 13:42:24 +02:00
amd_iommu_proto.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
amd_iommu_types.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
amd_iommu_v2.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
amd_iommu.c iommu/amd: Wait for completion of IOTLB flush in attach_device 2020-04-07 13:43:24 +02:00
arm-smmu-v3.c iommu/arm-smmu-v3: Use WRITE_ONCE() when changing validity of an STE 2020-04-07 13:56:53 +02:00
arm-smmu.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dma-iommu.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
dmar.c iommu/vt-d: Ignore devices with out-of-spec domain number 2020-04-07 14:11:55 +02:00
exynos-iommu.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
exynos-iommu.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
exynos-iovmm.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fsl_pamu_domain.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fsl_pamu_domain.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fsl_pamu.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
fsl_pamu.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
intel_irq_remapping.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
intel-iommu.c iommu/vt-d: Fix a bug in intel_iommu_iova_to_phys() for huge page 2020-04-07 14:11:46 +02:00
intel-svm.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
io-pgtable-arm.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
io-pgtable.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
io-pgtable.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
iommu-sysfs.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
iommu-traces.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
iommu.c iommu: Use right function to get group for device 2020-04-07 13:42:05 +02:00
iova.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
ipmmu-vmsa.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
irq_remapping.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
irq_remapping.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Kconfig A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
Makefile A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
msm_iommu_dev.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
msm_iommu_hw-8xxx.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
msm_iommu.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
msm_iommu.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
of_iommu.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
omap-iommu-debug.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
omap-iommu.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
omap-iommu.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
omap-iopgtable.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
rockchip-iommu.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
s390-iommu.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
shmobile-iommu.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
shmobile-ipmmu.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
shmobile-ipmmu.h A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
tegra-gart.c A750FXXU4CTBC 2020-03-27 21:51:54 +05:30
tegra-smmu.c iommu/tegra-smmu: Fix page tables in > 4 GiB memory 2020-04-07 13:22:44 +02:00