]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
s390/pci: Fix s390_mmio_read/write syscall page fault handling
authorNiklas Schnelle <schnelle@linux.ibm.com>
Wed, 26 Feb 2025 12:07:45 +0000 (13:07 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 20 Apr 2025 08:15:28 +0000 (10:15 +0200)
commit43e5e2879deecc286f2859791e7c795969aa4335
treee1b01e0c01852cd872c29965d0031aa77e77d847
parentdd3edffae868f34e494656245786de888189d2de
s390/pci: Fix s390_mmio_read/write syscall page fault handling

[ Upstream commit 41a0926e82f4963046876ed9a1b5f681be8087a8 ]

The s390 MMIO syscalls when using the classic PCI instructions do not
cause a page fault when follow_pfnmap_start() fails due to the page not
being present. Besides being a general deficiency this breaks vfio-pci's
mmap() handling once VFIO_PCI_MMAP gets enabled as this lazily maps on
first access. Fix this by following a failed follow_pfnmap_start() with
fixup_user_page() and retrying the follow_pfnmap_start(). Also fix
a VM_READ vs VM_WRITE mixup in the read syscall.

Link: https://lore.kernel.org/r/20250226-vfio_pci_mmap-v7-1-c5c0f1d26efd@linux.ibm.com
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Matthew Rosato <mjrosato@linux.ibm.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
arch/s390/pci/pci_mmio.c