Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933242AbdC3KNY (ORCPT ); Thu, 30 Mar 2017 06:13:24 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:54548 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933209AbdC3KNW (ORCPT ); Thu, 30 Mar 2017 06:13:22 -0400 From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Dave Martin , James Hogan , Linus Torvalds Subject: [PATCH 4.10 14/17] metag/ptrace: Reject partial NT_METAG_RPIPE writes Date: Thu, 30 Mar 2017 12:00:29 +0200 Message-Id: <20170330095927.904024572@linuxfoundation.org> X-Mailer: git-send-email 2.12.1 In-Reply-To: <20170330095925.918515862@linuxfoundation.org> References: <20170330095925.918515862@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1086 Lines: 35 4.10-stable review patch. If anyone has any objections, please let me know. ------------------ From: Dave Martin commit 7195ee3120d878259e8d94a5d9f808116f34d5ea upstream. It's not clear what behaviour is sensible when doing partial write of NT_METAG_RPIPE, so just don't bother. This patch assumes that userspace will never rely on a partial SETREGSET in this case, since it's not clear what should happen anyway. Signed-off-by: Dave Martin Acked-by: James Hogan Signed-off-by: Linus Torvalds Signed-off-by: Greg Kroah-Hartman --- arch/metag/kernel/ptrace.c | 2 ++ 1 file changed, 2 insertions(+) --- a/arch/metag/kernel/ptrace.c +++ b/arch/metag/kernel/ptrace.c @@ -253,6 +253,8 @@ int metag_rp_state_copyin(struct pt_regs unsigned long long *ptr; int ret, i; + if (count < 4*13) + return -EINVAL; /* Read the entire pipeline before making any changes */ ret = user_regset_copyin(&pos, &count, &kbuf, &ubuf, &rp, 0, 4*13);