1
0
Fork 0
remarkable-linux/drivers/iommu
Jean-Philippe Brucker 918cad16b4 iommu/io-pgtable-arm-v7s: Abort allocation when table address overflows the PTE
[ Upstream commit 29859aeb8a ]

When run on a 64-bit system in selftest, the v7s driver may obtain page
table with physical addresses larger than 32-bit. Level-2 tables are 1KB
and are are allocated with slab, which doesn't accept the GFP_DMA32
flag. Currently map() truncates the address written in the PTE, causing
iova_to_phys() or unmap() to access invalid memory. Kasan reports it as
a use-after-free. To avoid any nasty surprise, test if the physical
address fits in a PTE before returning a new table. 32-bit systems,
which are the main users of this page table format, shouldn't see any
difference.

Signed-off-by: Jean-Philippe Brucker <jean-philippe.brucker@arm.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Sasha Levin <alexander.levin@microsoft.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2018-09-26 08:37:59 +02:00
..
Kconfig iommu/qcom: Depend on HAS_DMA to fix compile error 2017-09-19 15:30:41 +02:00
Makefile License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
amd_iommu.c iommu/amd: Take into account that alloc_dev_data() may return NULL 2018-05-30 07:52:27 +02:00
amd_iommu_init.c iommu/amd: pr_err() strings should end with newlines 2017-09-27 17:01:35 +02:00
amd_iommu_proto.h IOMMU Updates for Linux v4.14 2017-09-09 15:03:24 -07:00
amd_iommu_types.h IOMMU Updates for Linux v4.14 2017-09-09 15:03:24 -07:00
amd_iommu_v2.c IOMMU Updates for Linux v4.14 2017-09-09 15:03:24 -07:00
arm-smmu-regs.h iommu/arm-smmu: Split out register defines 2017-08-15 17:34:48 +02:00
arm-smmu-v3.c iommu/arm-smmu-v3: sync the OVACKFLG to PRIQ consumer register 2018-09-26 08:37:58 +02:00
arm-smmu.c iommu/arm-smmu: Error out only if not enough context interrupts 2018-09-05 09:26:34 +02:00
dma-iommu.c IOMMU Updates for Linux v4.13 2017-07-12 10:00:04 -07:00
dmar.c iommu/vt-d: Fix dev iotlb pfsid use 2018-09-09 19:56:00 +02:00
exynos-iommu.c iommu/exynos: Don't unconditionally steal bus ops 2018-04-26 11:02:06 +02:00
fsl_pamu.c Merge branches 'arm/exynos', 'arm/renesas', 'arm/rockchip', 'arm/omap', 'arm/mediatek', 'arm/tegra', 'arm/qcom', 'arm/smmu', 'ppc/pamu', 'x86/vt-d', 'x86/amd', 's390' and 'core' into next 2017-09-01 11:31:42 +02:00
fsl_pamu.h iommu/pamu: Fix PAMU boot crash 2017-08-23 16:28:09 +02:00
fsl_pamu_domain.c Merge branches 'arm/exynos', 'arm/renesas', 'arm/rockchip', 'arm/omap', 'arm/mediatek', 'arm/tegra', 'arm/qcom', 'arm/smmu', 'ppc/pamu', 'x86/vt-d', 'x86/amd', 's390' and 'core' into next 2017-09-01 11:31:42 +02:00
fsl_pamu_domain.h iommu/pamu: Fix PAMU boot crash 2017-08-23 16:28:09 +02:00
intel-iommu.c iommu/vt-d: Fix dev iotlb pfsid use 2018-09-09 19:56:00 +02:00
intel-svm.c iommu/vt-d: Fix a potential memory leak 2018-04-24 09:36:33 +02:00
intel_irq_remapping.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
io-pgtable-arm-v7s.c iommu/io-pgtable-arm-v7s: Abort allocation when table address overflows the PTE 2018-09-26 08:37:59 +02:00
io-pgtable-arm.c iommu/io-pgtable: Sanitise map/unmap addresses 2017-07-20 10:30:28 +01:00
io-pgtable.c iommu/io-pgtable: Fix a brace coding style issue. 2016-04-05 15:34:29 +02:00
io-pgtable.h License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
iommu-sysfs.c iommu: Fix wrong freeing of iommu_device->dev 2017-08-15 13:58:48 +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 Merge branches 'arm/exynos', 'arm/renesas', 'arm/rockchip', 'arm/omap', 'arm/mediatek', 'arm/tegra', 'arm/qcom', 'arm/smmu', 'ppc/pamu', 'x86/vt-d', 'x86/amd', 's390' and 'core' into next 2017-09-01 11:31:42 +02:00
iova.c iommu/iova: Add flush timer 2017-08-15 18:23:52 +02:00
ipmmu-vmsa.c iommu/ipmmu-vmsa: Fix allocation in atomic context 2018-09-19 22:43:44 +02:00
irq_remapping.c x86/cpufeature: Replace cpu_has_apic with boot_cpu_has() usage 2016-04-13 11:37:41 +02:00
irq_remapping.h iommu, x86: Setup Posted-Interrupts capability for Intel iommu 2015-06-12 11:33:52 +02:00
msm_iommu.c iommu/msm: Add iommu_group support 2017-08-10 00:03:50 +02:00
msm_iommu.h iommu/msm: Make use of iommu_device_register interface 2017-02-10 13:44:57 +01:00
msm_iommu_hw-8xxx.h iommu/msm: Move mach includes to iommu directory 2013-08-06 11:18:03 -07:00
mtk_iommu.c iommu/mediatek: Fix protect memory setting 2018-05-30 07:52:30 +02:00
mtk_iommu.h iommu/mediatek: Fix protect memory setting 2018-05-30 07:52:30 +02:00
mtk_iommu_v1.c iommu/mediatek: Fix driver name 2017-12-20 10:10:24 +01:00
of_iommu.c iommu/of: Remove PCI host bridge node check 2017-09-22 12:05:43 +02:00
omap-iommu-debug.c iommu/omap: Align code with open parenthesis 2016-04-05 17:53:20 +02:00
omap-iommu.c iommu/omap: Fix cache flushes on L2 table entries 2018-09-15 09:45:31 +02:00
omap-iommu.h iommu/omap: Use DMA-API for performing cache flushes 2017-08-04 11:59:29 +02:00
omap-iopgtable.h iommu/omap: Use BIT(x) macros in omap-iopgtable.h 2015-08-03 16:04:42 +02:00
qcom_iommu.c iommu: qcom: annotate PM functions as __maybe_unused 2017-08-28 11:24:52 +02:00
rockchip-iommu.c Merge branches 'arm/exynos', 'arm/renesas', 'arm/rockchip', 'arm/omap', 'arm/mediatek', 'arm/tegra', 'arm/qcom', 'arm/smmu', 'ppc/pamu', 'x86/vt-d', 'x86/amd', 's390' and 'core' into next 2017-09-01 11:31:42 +02:00
s390-iommu.c License cleanup: add SPDX GPL-2.0 license identifier to files with no license 2017-11-02 11:10:55 +01:00
tegra-gart.c iommu/tegra-gart: Add support for struct iommu_device 2017-08-17 16:31:34 +02:00
tegra-smmu.c arm/tegra: Call bus_set_iommu() after iommu_device_register() 2017-08-30 17:28:32 +02:00