https://github.com/torvalds/linux
Revision 140456f994195b568ecd7fc2287a34eadffef3ca authored by Andrey Ryabinin on 17 February 2021, 14:30:04 UTC, committed by Joerg Roedel on 04 March 2021, 12:15:56 UTC
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>
1 parent 45e606f
History
Tip revision: 140456f994195b568ecd7fc2287a34eadffef3ca authored by Andrey Ryabinin on 17 February 2021, 14:30:04 UTC
iommu/amd: Fix sleeping in atomic in increase_address_space()
Tip revision: 140456f
File Mode Size
atmel_lcdc.h -rw-r--r-- 6.2 KB
aty128.h -rw-r--r-- 13.3 KB
broadsheetfb.h -rw-r--r-- 2.1 KB
cirrus.h -rw-r--r-- 5.7 KB
cvisionppc.h -rw-r--r-- 1.5 KB
da8xx-fb.h -rw-r--r-- 2.0 KB
display_timing.h -rw-r--r-- 3.1 KB
edid.h -rw-r--r-- 228 bytes
gbe.h -rw-r--r-- 10.4 KB
hecubafb.h -rw-r--r-- 1.5 KB
ili9320.h -rw-r--r-- 5.7 KB
imx-ipu-image-convert.h -rw-r--r-- 6.5 KB
imx-ipu-v3.h -rw-r--r-- 16.3 KB
kyro.h -rw-r--r-- 2.4 KB
mach64.h -rw-r--r-- 46.9 KB
maxinefb.h -rw-r--r-- 1.2 KB
metronomefb.h -rw-r--r-- 1.5 KB
mipi_display.h -rw-r--r-- 5.0 KB
mmp_disp.h -rw-r--r-- 7.0 KB
neomagic.h -rw-r--r-- 4.9 KB
newport.h -rw-r--r-- 18.7 KB
of_display_timing.h -rw-r--r-- 788 bytes
of_videomode.h -rw-r--r-- 367 bytes
omap-panel-data.h -rw-r--r-- 1.7 KB
omapfb_dss.h -rw-r--r-- 23.9 KB
omapvrfb.h -rw-r--r-- 1.8 KB
permedia2.h -rw-r--r-- 9.0 KB
platform_lcd.h -rw-r--r-- 440 bytes
pm3fb.h -rw-r--r-- 45.3 KB
pmag-ba-fb.h -rw-r--r-- 1.0 KB
pmagb-b-fb.h -rw-r--r-- 2.3 KB
pxa168fb.h -rw-r--r-- 2.5 KB
radeon.h -rw-r--r-- 109.2 KB
s1d13xxxfb.h -rw-r--r-- 9.9 KB
sa1100fb.h -rw-r--r-- 1.3 KB
samsung_fimd.h -rw-r--r-- 17.0 KB
sh_mobile_lcdc.h -rw-r--r-- 6.0 KB
sisfb.h -rw-r--r-- 606 bytes
sstfb.h -rw-r--r-- 11.0 KB
tdfx.h -rw-r--r-- 5.3 KB
tgafb.h -rw-r--r-- 6.9 KB
trident.h -rw-r--r-- 3.2 KB
udlfb.h -rw-r--r-- 2.9 KB
uvesafb.h -rw-r--r-- 2.9 KB
vga.h -rw-r--r-- 13.7 KB
videomode.h -rw-r--r-- 1.3 KB
w100fb.h -rw-r--r-- 3.6 KB

back to top