public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Heiko Carstens <hca@linux.ibm.com>,
	Sven Schnelle <svens@linux.ibm.com>,
	Vasily Gorbik <gor@linux.ibm.com>,
	Sasha Levin <sashal@kernel.org>,
	oleg@redhat.com, agordeev@linux.ibm.com,
	linux-s390@vger.kernel.org
Subject: [PATCH AUTOSEL 5.15 08/11] s390/ptrace: fix PTRACE_GET_LAST_BREAK error handling
Date: Thu,  6 Apr 2023 07:32:47 -0400	[thread overview]
Message-ID: <20230406113250.648634-8-sashal@kernel.org> (raw)
In-Reply-To: <20230406113250.648634-1-sashal@kernel.org>

From: Heiko Carstens <hca@linux.ibm.com>

[ Upstream commit f9bbf25e7b2b74b52b2f269216a92657774f239c ]

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>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 arch/s390/kernel/ptrace.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/arch/s390/kernel/ptrace.c b/arch/s390/kernel/ptrace.c
index 0ea3d02b378de..516c21baf3ad3 100644
--- a/arch/s390/kernel/ptrace.c
+++ b/arch/s390/kernel/ptrace.c
@@ -481,9 +481,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;
@@ -837,9 +835,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);
 }
-- 
2.39.2


  parent reply	other threads:[~2023-04-06 11:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-06 11:32 [PATCH AUTOSEL 5.15 01/11] f2fs: Fix f2fs_truncate_partial_nodes ftrace event Sasha Levin
2023-04-06 11:32 ` [PATCH AUTOSEL 5.15 02/11] Input: i8042 - add quirk for Fujitsu Lifebook A574/H Sasha Levin
2023-04-06 11:32 ` [PATCH AUTOSEL 5.15 03/11] platform/x86 (gigabyte-wmi): Add support for A320M-S2H V2 Sasha Levin
2023-04-06 11:32 ` [PATCH AUTOSEL 5.15 04/11] selftests: sigaltstack: fix -Wuninitialized Sasha Levin
2023-04-06 11:32 ` [PATCH AUTOSEL 5.15 05/11] scsi: megaraid_sas: Fix fw_crash_buffer_show() Sasha Levin
2023-04-06 11:32 ` [PATCH AUTOSEL 5.15 06/11] scsi: core: Improve scsi_vpd_inquiry() checks Sasha Levin
2023-04-06 11:32 ` [PATCH AUTOSEL 5.15 07/11] net: dsa: b53: mmap: add phy ops Sasha Levin
2023-04-06 11:32 ` Sasha Levin [this message]
2023-04-06 11:32 ` [PATCH AUTOSEL 5.15 09/11] nvme-tcp: fix a possible UAF when failing to allocate an io queue Sasha Levin
2023-04-06 11:32 ` [PATCH AUTOSEL 5.15 10/11] xen/netback: use same error messages for same errors Sasha Levin
2023-04-06 11:32 ` [PATCH AUTOSEL 5.15 11/11] platform/x86: gigabyte-wmi: add support for X570S AORUS ELITE Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230406113250.648634-8-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=agordeev@linux.ibm.com \
    --cc=gor@linux.ibm.com \
    --cc=hca@linux.ibm.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=stable@vger.kernel.org \
    --cc=svens@linux.ibm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox