From patchwork Tue Aug 26 14:13:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 36031 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-oa0-f71.google.com (mail-oa0-f71.google.com [209.85.219.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 8E2912054F for ; Tue, 26 Aug 2014 14:16:16 +0000 (UTC) Received: by mail-oa0-f71.google.com with SMTP id g18sf88023607oah.2 for ; Tue, 26 Aug 2014 07:16:16 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:subject:date:message-id :in-reply-to:references:cc:precedence:list-id:list-unsubscribe :list-archive:list-post:list-help:list-subscribe:mime-version:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:content-type:content-transfer-encoding; bh=ifbWjdZFsyEpwyl6yAGzqxLnr06Nz305GrYDLEq9WIs=; b=hSqnBnlMqyRKHiSUKFwAaRukUzjLJ44AoB5j1FjYskrRwvigWKKcdQJfwGKukADgZe ckxHntIASIlsvtXc90XQUK0A9/Q/8Ywz++KfLkGm8nBX46uaGaVSR7FGcMpfYim+PAEQ nBVt1hYEJzWMBhS8ImjC57hZa97AYDJ8+QYFArlWQsWx3+VVy3866SBVwXOob0pcU9gl lusxlpsFoxXE7AvKnn6bzER4H3GVuDtbKhW13FD8VNX56N+3jA8J/bdKpld30rPAujYR AmWkvFPa7AJd3cy2W4Tmh+8lW+iZDrs+2UJIKmiOlEyEk7MucbCOGUCIa6UjuQoV/1zV k87g== X-Gm-Message-State: ALoCoQnPUwTTWusbzt/Bm3nCudPeLBFEKvWuEeVKsc+l77zZFgmiyhOoNLvMi8G3Ez2FtRztBh9t X-Received: by 10.42.121.72 with SMTP id i8mr22129180icr.10.1409062576166; Tue, 26 Aug 2014 07:16:16 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.96.202 with SMTP id k68ls2674920qge.48.gmail; Tue, 26 Aug 2014 07:16:15 -0700 (PDT) X-Received: by 10.236.148.209 with SMTP id v57mr1320770yhj.140.1409062575896; Tue, 26 Aug 2014 07:16:15 -0700 (PDT) Received: from mail-yh0-f44.google.com (mail-yh0-f44.google.com [209.85.213.44]) by mx.google.com with ESMTPS id p1si2474105yhp.176.2014.08.26.07.16.15 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 26 Aug 2014 07:16:15 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.213.44 as permitted sender) client-ip=209.85.213.44; Received: by mail-yh0-f44.google.com with SMTP id f73so11858341yha.31 for ; Tue, 26 Aug 2014 07:16:15 -0700 (PDT) X-Received: by 10.220.187.134 with SMTP id cw6mr518004vcb.71.1409062575798; Tue, 26 Aug 2014 07:16:15 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.45.67 with SMTP id uj3csp202798vcb; Tue, 26 Aug 2014 07:16:15 -0700 (PDT) X-Received: by 10.66.158.130 with SMTP id wu2mr37578082pab.59.1409062575004; Tue, 26 Aug 2014 07:16:15 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id v3si4521234pds.170.2014.08.26.07.16.14 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 26 Aug 2014 07:16:14 -0700 (PDT) Received-SPF: none (google.com: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org does not designate permitted sender hosts) client-ip=2001:1868:205::9; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XMHWZ-0001qG-DR; Tue, 26 Aug 2014 14:15:03 +0000 Received: from cam-admin0.cambridge.arm.com ([217.140.96.50]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XMHVF-00085T-PG for linux-arm-kernel@lists.infradead.org; Tue, 26 Aug 2014 14:13:43 +0000 Received: from edgewater-inn.cambridge.arm.com (edgewater-inn.cambridge.arm.com [10.1.203.34]) by cam-admin0.cambridge.arm.com (8.12.6/8.12.6) with ESMTP id s7QEDIwo011808; Tue, 26 Aug 2014 15:13:18 +0100 (BST) Received: by edgewater-inn.cambridge.arm.com (Postfix, from userid 1000) id CEE1C1AE06C1; Tue, 26 Aug 2014 15:13:37 +0100 (BST) From: Will Deacon To: linux-arm-kernel@lists.infradead.org Subject: [PATCH 10/11] arm64: ptrace: fix compat reg getter/setter return values Date: Tue, 26 Aug 2014 15:13:29 +0100 Message-Id: <1409062410-25891-11-git-send-email-will.deacon@arm.com> X-Mailer: git-send-email 2.1.0.rc1 In-Reply-To: <1409062410-25891-1-git-send-email-will.deacon@arm.com> References: <1409062410-25891-1-git-send-email-will.deacon@arm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140826_071342_213279_A76175A6 X-CRM114-Status: GOOD ( 10.30 ) X-Spam-Score: -5.0 (-----) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-5.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -5.0 RCVD_IN_DNSWL_HI RBL: Sender listed at http://www.dnswl.org/, high trust [217.140.96.50 listed in list.dnswl.org] 0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.0 SPF_PASS SPF: sender matches SPF record Cc: catalin.marinas@arm.com, Will Deacon X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: , List-Help: , List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: will.deacon@arm.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.213.44 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 copy_{to,from}_user return the number of bytes remaining on failure, not an error code. This patch returns -EFAULT when the copy operation didn't complete, rather than expose the number of bytes not copied directly to userspace. Signed-off-by: Will Deacon --- arch/arm64/kernel/ptrace.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/arch/arm64/kernel/ptrace.c b/arch/arm64/kernel/ptrace.c index 2ac998878001..fe63ac5e9bf5 100644 --- a/arch/arm64/kernel/ptrace.c +++ b/arch/arm64/kernel/ptrace.c @@ -663,8 +663,10 @@ static int compat_gpr_get(struct task_struct *target, kbuf += sizeof(reg); } else { ret = copy_to_user(ubuf, ®, sizeof(reg)); - if (ret) + if (ret) { + ret = -EFAULT; break; + } ubuf += sizeof(reg); } @@ -702,8 +704,10 @@ static int compat_gpr_set(struct task_struct *target, kbuf += sizeof(reg); } else { ret = copy_from_user(®, ubuf, sizeof(reg)); - if (ret) - return ret; + if (ret) { + ret = -EFAULT; + break; + } ubuf += sizeof(reg); }