s390/ptrace: fix PTRACE_GET_LAST_BREAK error handling
authorHeiko Carstens <hca@linux.ibm.com>
Mon, 6 Mar 2023 11:31:30 +0000 (12:31 +0100)
committerVasily Gorbik <gor@linux.ibm.com>
Mon, 27 Mar 2023 15:23:08 +0000 (17:23 +0200)
Return -EFAULT if put_user() for the PTRACE_GET_LAST_BREAK
request fails, instead of silently ignoring it.

Reviewed-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Vasily Gorbik <gor@linux.ibm.com>
arch/s390/kernel/ptrace.c

index cf9659e..ea244a7 100644 (file)
@@ -474,9 +474,7 @@ long arch_ptrace(struct task_struct *child, long request,
                }
                return 0;
        case PTRACE_GET_LAST_BREAK:
-               put_user(child->thread.last_break,
-                        (unsigned long __user *) data);
-               return 0;
+               return put_user(child->thread.last_break, (unsigned long __user *)data);
        case PTRACE_ENABLE_TE:
                if (!MACHINE_HAS_TE)
                        return -EIO;
@@ -824,9 +822,7 @@ long compat_arch_ptrace(struct task_struct *child, compat_long_t request,
                }
                return 0;
        case PTRACE_GET_LAST_BREAK:
-               put_user(child->thread.last_break,
-                        (unsigned int __user *) data);
-               return 0;
+               return put_user(child->thread.last_break, (unsigned int __user *)data);
        }
        return compat_ptrace_request(child, request, addr, data);
 }