Return-Path: Received: from mail-by2nam01on0114.outbound.protection.outlook.com ([104.47.34.114]:20358 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753138AbeARVBw (ORCPT ); Thu, 18 Jan 2018 16:01:52 -0500 From: Sasha Levin To: "stable@vger.kernel.org" , "stable-commits@vger.kernel.org" CC: Dave Martin , Linus Torvalds , Sasha Levin Subject: [added to the 4.1 stable tree] metag/ptrace: Preserve previous registers for short regset write Date: Thu, 18 Jan 2018 21:00:11 +0000 Message-ID: <20180118205908.3220-91-alexander.levin@microsoft.com> References: <20180118205908.3220-1-alexander.levin@microsoft.com> In-Reply-To: <20180118205908.3220-1-alexander.levin@microsoft.com> Content-Language: en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org List-ID: From: Dave Martin This patch has been added to the stable tree. If you have any objections, please let us know. =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D [ Upstream commit a78ce80d2c9178351b34d78fec805140c29c193e ] Ensure that if userspace supplies insufficient data to PTRACE_SETREGSET to fill all the registers, the thread's old registers are preserved. Signed-off-by: Dave Martin Acked-by: James Hogan Signed-off-by: Linus Torvalds Signed-off-by: Sasha Levin --- arch/metag/kernel/ptrace.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/metag/kernel/ptrace.c b/arch/metag/kernel/ptrace.c index 7563628822bd..ae659ba61948 100644 --- a/arch/metag/kernel/ptrace.c +++ b/arch/metag/kernel/ptrace.c @@ -303,7 +303,7 @@ static int metag_tls_set(struct task_struct *target, const void *kbuf, const void __user *ubuf) { int ret; - void __user *tls; + void __user *tls =3D target->thread.tls_ptr; =20 ret =3D user_regset_copyin(&pos, &count, &kbuf, &ubuf, &tls, 0, -1); if (ret) --=20 2.11.0