lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241015164326.124987-5-imbrenda@linux.ibm.com>
Date: Tue, 15 Oct 2024 18:43:19 +0200
From: Claudio Imbrenda <imbrenda@...ux.ibm.com>
To: linux-kernel@...r.kernel.org
Cc: borntraeger@...ibm.com, nsg@...ux.ibm.com, nrb@...ux.ibm.com,
        frankja@...ux.ibm.com, seiden@...ux.ibm.com, hca@...ux.ibm.com,
        agordeev@...ux.ibm.com, gor@...ux.ibm.com,
        gerald.schaefer@...ux.ibm.com, kvm@...r.kernel.org,
        linux-s390@...r.kernel.org
Subject: [PATCH v3 04/11] s390/mm/gmap: Fix __gmap_fault() return code

Errors in fixup_user_fault() were masked and -EFAULT was returned for
any error, including out of memory.

Fix this by returning the correct error code. This means that in many
cases the error code will be propagated all the way to userspace.

Suggested-by: Heiko Carstens <hca@...ux.ibm.com>
Signed-off-by: Claudio Imbrenda <imbrenda@...ux.ibm.com>
Reviewed-by: Heiko Carstens <hca@...ux.ibm.com>
Acked-by: Alexander Gordeev <agordeev@...ux.ibm.com>
---
 arch/s390/mm/gmap.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/arch/s390/mm/gmap.c b/arch/s390/mm/gmap.c
index f51ad948ba53..a8746f71c679 100644
--- a/arch/s390/mm/gmap.c
+++ b/arch/s390/mm/gmap.c
@@ -718,13 +718,12 @@ static int __gmap_fault(struct gmap *gmap, unsigned long gaddr, unsigned int fau
 	if (IS_ERR_VALUE(vmaddr))
 		return vmaddr;
 
-	if (fault_flags & FAULT_FLAG_RETRY_NOWAIT) {
+	if (fault_flags & FAULT_FLAG_RETRY_NOWAIT)
 		rc = fixup_user_fault_nowait(gmap->mm, vmaddr, fault_flags, &unlocked);
-		if (rc)
-			return rc;
-	} else if (fixup_user_fault(gmap->mm, vmaddr, fault_flags, &unlocked)) {
-		return -EFAULT;
-	}
+	else
+		rc = fixup_user_fault(gmap->mm, vmaddr, fault_flags, &unlocked);
+	if (rc)
+		return rc;
 	/*
 	 * In the case that fixup_user_fault unlocked the mmap_lock during
 	 * fault-in, redo __gmap_translate() to avoid racing with a
-- 
2.47.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ