All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] s390/pci: Fix s390_pci_mmio_write syscall error return without MIO
@ 2026-07-22 13:08 Niklas Schnelle
  2026-07-22 13:18 ` sashiko-bot
  2026-07-23  9:16 ` Vasily Gorbik
  0 siblings, 2 replies; 3+ messages in thread
From: Niklas Schnelle @ 2026-07-22 13:08 UTC (permalink / raw)
  To: Gerd Bayer, Tobias Schumacher, Matthew Rosato, Ramesh Errabolu,
	Benjamin Block, Julian Ruess, Farhan Ali, Simona Vetter
  Cc: Halil Pasic, Gerald Schaefer, Peter Oberparleiter,
	Christian Borntraeger, Heiko Carstens, Vasily Gorbik,
	Alexander Gordeev, Sven Schnelle, Niklas Schnelle, linux-s390,
	linux-kernel

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>
---
 arch/s390/pci/pci_mmio.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/s390/pci/pci_mmio.c b/arch/s390/pci/pci_mmio.c
index 51e7a28af899..f3f79ba78410 100644
--- a/arch/s390/pci/pci_mmio.c
+++ b/arch/s390/pci/pci_mmio.c
@@ -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));
 

---
base-commit: 1590cf0329716306e948a8fc29f1d3ee87d3989f
change-id: 20260721-b4-syscall_mmio_ret_fix_upstream-ec4d2d08a6c6

Best regards,
-- 
Niklas Schnelle


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] s390/pci: Fix s390_pci_mmio_write syscall error return without MIO
  2026-07-22 13:08 [PATCH] s390/pci: Fix s390_pci_mmio_write syscall error return without MIO Niklas Schnelle
@ 2026-07-22 13:18 ` sashiko-bot
  2026-07-23  9:16 ` Vasily Gorbik
  1 sibling, 0 replies; 3+ messages in thread
From: sashiko-bot @ 2026-07-22 13:18 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Vasily Gorbik, linux-s390, Alexander Gordeev, Heiko Carstens

> 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>

Sashiko has reviewed this patch and found no issues. It looks great!

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260722-b4-syscall_mmio_ret_fix_upstream-v1-1-6de516b33001@linux.ibm.com?part=1


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] s390/pci: Fix s390_pci_mmio_write syscall error return without MIO
  2026-07-22 13:08 [PATCH] s390/pci: Fix s390_pci_mmio_write syscall error return without MIO Niklas Schnelle
  2026-07-22 13:18 ` sashiko-bot
@ 2026-07-23  9:16 ` Vasily Gorbik
  1 sibling, 0 replies; 3+ messages in thread
From: Vasily Gorbik @ 2026-07-23  9:16 UTC (permalink / raw)
  To: Niklas Schnelle
  Cc: Gerd Bayer, Tobias Schumacher, Matthew Rosato, Ramesh Errabolu,
	Benjamin Block, Julian Ruess, Farhan Ali, Simona Vetter,
	Halil Pasic, Gerald Schaefer, Peter Oberparleiter,
	Christian Borntraeger, Heiko Carstens, Alexander Gordeev,
	Sven Schnelle, linux-s390, linux-kernel

On Wed, Jul 22, 2026 at 03:08:34PM +0200, Niklas Schnelle wrote:
> 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>
> ---
>  arch/s390/pci/pci_mmio.c | 1 +
>  1 file changed, 1 insertion(+)

Applied, thank you!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-07-23  9:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-07-22 13:08 [PATCH] s390/pci: Fix s390_pci_mmio_write syscall error return without MIO Niklas Schnelle
2026-07-22 13:18 ` sashiko-bot
2026-07-23  9:16 ` Vasily Gorbik

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.