linux/drivers/iommu
Andrey Ryabinin 140456f994 iommu/amd: Fix sleeping in atomic in increase_address_space()
increase_address_space() calls get_zeroed_page(gfp) under spin_lock with
disabled interrupts. gfp flags passed to increase_address_space() may allow
sleeping, so it comes to this:

 BUG: sleeping function called from invalid context at mm/page_alloc.c:4342
 in_atomic(): 1, irqs_disabled(): 1, pid: 21555, name: epdcbbf1qnhbsd8

 Call Trace:
  dump_stack+0x66/0x8b
  ___might_sleep+0xec/0x110
  __alloc_pages_nodemask+0x104/0x300
  get_zeroed_page+0x15/0x40
  iommu_map_page+0xdd/0x3e0
  amd_iommu_map+0x50/0x70
  iommu_map+0x106/0x220
  vfio_iommu_type1_ioctl+0x76e/0x950 [vfio_iommu_type1]
  do_vfs_ioctl+0xa3/0x6f0
  ksys_ioctl+0x66/0x70
  __x64_sys_ioctl+0x16/0x20
  do_syscall_64+0x4e/0x100
  entry_SYSCALL_64_after_hwframe+0x44/0xa9

Fix this by moving get_zeroed_page() out of spin_lock/unlock section.

Fixes: 754265bcab ("iommu/amd: Fix race in increase_address_space()")
Signed-off-by: Andrey Ryabinin <arbn@yandex-team.com>
Acked-by: Will Deacon <will@kernel.org>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20210217143004.19165-1-arbn@yandex-team.com
Signed-off-by: Joerg Roedel <jroedel@suse.de>
2021-03-04 13:15:56 +01:00
..
amd iommu/amd: Fix sleeping in atomic in increase_address_space() 2021-03-04 13:15:56 +01:00
arm Merge branch 'for-joerg/mtk' into for-joerg/arm-smmu/updates 2021-02-01 12:59:28 +00:00
intel Merge branches 'arm/renesas', 'arm/smmu', 'x86/amd', 'x86/vt-d' and 'core' into next 2021-02-12 15:27:17 +01:00
dma-iommu.c iommu: use the __iommu_attach_device() directly for deferred attach 2021-01-28 13:27:21 +01:00
exynos-iommu.c iommu/exynos: add missing put_device() call in exynos_iommu_of_xlate() 2020-09-24 10:48:29 +02:00
fsl_pamu.c iommu/pamu: Replace use of kzfree with kfree_sensitive 2020-09-18 10:59:04 +02:00
fsl_pamu.h
fsl_pamu_domain.c
fsl_pamu_domain.h
hyperv-iommu.c iommu/hyper-v: Remove I/O-APIC ID check from hyperv_irq_remapping_select() 2020-12-02 11:22:55 +01:00
io-pgtable-arm-v7s.c iommu/io-pgtable-arm-v7s: Quad lvl1 pgtable for MediaTek 2021-02-01 11:31:17 +00:00
io-pgtable-arm.c IOMMU updates for 5.11 2020-12-16 13:58:47 -08: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.c iommu/amd: Prepare for generic IO page table framework 2021-01-28 16:51:17 +01:00
ioasid.c iommu/ioasid: Add ioasid references 2020-11-23 14:16:55 +00:00
iommu-debugfs.c
iommu-sva-lib.c iommu/sva: Add PASID helpers 2020-11-23 14:16:55 +00:00
iommu-sva-lib.h iommu/sva: Add PASID helpers 2020-11-23 14:16:55 +00:00
iommu-sysfs.c
iommu-traces.c
iommu.c Merge branches 'arm/renesas', 'arm/smmu', 'x86/amd', 'x86/vt-d' and 'core' into next 2021-02-12 15:27:17 +01:00
iova.c iova: Stop exporting some more functions 2021-01-27 12:28:58 +01:00
ipmmu-vmsa.c iommu/ipmmu-vmsa: Allow SDHI devices 2021-01-29 09:27:21 +01: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/arm-smmu-v3: Implement iommu_sva_bind/unbind() 2020-11-23 14:16:55 +00:00
Makefile iommu/sva: Add PASID helpers 2020-11-23 14:16:55 +00:00
msm_iommu.c iommu/msm: Hook up iotlb_sync_map 2021-01-28 20:29:56 +00:00
msm_iommu.h
msm_iommu_hw-8xxx.h
mtk_iommu.c iommu/mediatek: Fix error code in probe() 2021-02-08 09:11:06 +01:00
mtk_iommu.h iommu/mediatek: Add mt8192 support 2021-02-01 11:31:19 +00:00
mtk_iommu_v1.c
of_iommu.c of/device: Add input id to of_dma_configure() 2020-07-28 15:51:32 +01:00
omap-iommu-debug.c iommu/omap: Check for failure of a call to omap_iommu_dump_ctx 2020-07-22 15:02:33 +02:00
omap-iommu.c Merge branches 'arm/renesas', 'arm/qcom', 'arm/mediatek', 'arm/omap', 'arm/exynos', 'arm/smmu', 'ppc/pamu', 'x86/vt-d', 'x86/amd' and 'core' into next 2020-07-29 14:42:00 +02:00
omap-iommu.h
omap-iopgtable.h
rockchip-iommu.c
s390-iommu.c
sun50i-iommu.c iommu/sun50i: Fix set-but-not-used variable warning 2020-09-04 13:39:45 +02:00
tegra-gart.c iommu: Switch gather->end to the inclusive end 2021-01-27 12:32:27 +00:00
tegra-smmu.c iommu/tegra-smmu: Add PCI support 2020-11-25 11:04:41 +00:00
virtio-iommu.c treewide: Use fallthrough pseudo-keyword 2020-08-23 17:36:59 -05:00