Skip to content

Commit 473aaf5

Browse files
Claudio Imbrendahcahca
authored andcommitted
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@linux.ibm.com> Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com> Reviewed-by: Heiko Carstens <hca@linux.ibm.com> Acked-by: Alexander Gordeev <agordeev@linux.ibm.com> Link: https://lore.kernel.org/r/20241022120601.167009-5-imbrenda@linux.ibm.com Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
1 parent 075fd73 commit 473aaf5

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

arch/s390/mm/gmap.c

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -718,13 +718,12 @@ static int __gmap_fault(struct gmap *gmap, unsigned long gaddr, unsigned int fau
718718
if (IS_ERR_VALUE(vmaddr))
719719
return vmaddr;
720720

721-
if (fault_flags & FAULT_FLAG_RETRY_NOWAIT) {
721+
if (fault_flags & FAULT_FLAG_RETRY_NOWAIT)
722722
rc = fixup_user_fault_nowait(gmap->mm, vmaddr, fault_flags, &unlocked);
723-
if (rc)
724-
return rc;
725-
} else if (fixup_user_fault(gmap->mm, vmaddr, fault_flags, &unlocked)) {
726-
return -EFAULT;
727-
}
723+
else
724+
rc = fixup_user_fault(gmap->mm, vmaddr, fault_flags, &unlocked);
725+
if (rc)
726+
return rc;
728727
/*
729728
* In the case that fixup_user_fault unlocked the mmap_lock during
730729
* fault-in, redo __gmap_translate() to avoid racing with a

0 commit comments

Comments
 (0)