]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
s390/pci: Fix s390_pci_mmio_write syscall error return without MIO
authorNiklas Schnelle <schnelle@linux.ibm.com>
Wed, 22 Jul 2026 13:08:34 +0000 (15:08 +0200)
committerVasily Gorbik <gor@linux.ibm.com>
Fri, 31 Jul 2026 11:31:19 +0000 (13:31 +0200)
On a machine without PCI memory-I/O (MIO) support or when running with
pci=nomio the s390 specific PCI MMIO write syscall checks if the MMIO
cookie is above ZPCI_IOMAP_ADDR_BASE as a sanity check before even
trying to perform the MMIO. If this check fails the return value was
left unchanged and thus 0 from prior operations falsely indicating
success. This could potentially confuse user-space into falsely
believing the MMIO, on a mapping not valid for MMIO was successful.

Fix this by setting the return value to -EFAULT prior to the check
following the same pattern as elsewhere in the same function.

Cc: stable@vger.kernel.org
Reviewed-by: Julian Ruess <julianr@linux.ibm.com>
Reviewed-by: Farhan Ali <alifm@linux.ibm.com>
Fixes: a67a88b0b8de ("s390/pci: remove races against pte updates")
Signed-off-by: Niklas Schnelle <schnelle@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/pci/pci_mmio.c

index 51e7a28af8994ad8199918ebaabc32a00416437b..f3f79ba78410a47d8ba57d47991353905573af9e 100644 (file)
@@ -188,6 +188,7 @@ SYSCALL_DEFINE3(s390_pci_mmio_write, unsigned long, mmio_addr,
                        goto out_unlock_mmap;
        }
 
+       ret = -EFAULT;
        io_addr = (void __iomem *)((args.pfn << PAGE_SHIFT) |
                        (mmio_addr & ~PAGE_MASK));