From patchwork Fri Sep 26 13:16:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 37973 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f69.google.com (mail-ee0-f69.google.com [74.125.83.69]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 6572D202DB for ; Fri, 26 Sep 2014 13:21:08 +0000 (UTC) Received: by mail-ee0-f69.google.com with SMTP id d49sf1608474eek.0 for ; Fri, 26 Sep 2014 06:21:07 -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=+s3jcBZJJlUmACWkekoml5yB3P1FaFvr+uMxRgjAhE4=; b=TwhYSgJ57Ugwpkde0qOVuOh4imR/qlk/QosTKUGFGjlQ9guxtNKk0ledPKMB8247ya hEQVWO6wTdJ8RCe993o29ta6qszD+W32t3YVvz/Wr2tAEA9Iih1+snl3llBFleBRD9nv QFfl+CQ6CtNTmt6nD9mkgdtpuW67DFRUZEF8v36SepgphtjufjkSxuiym3VW2/pljrss NB/0eF1mPR3h1elPhq0fJdI7udxM6bAwVlcRXX8aiggzkg1Se4MFo0deN3UrdVvv8Ci0 4jwDtr6AEMWlp5ZWblY1nOZRdYvzfio4tBac27ld/yUMi94DkIhbSMHIBXY00ECoE+SX BSXA== X-Gm-Message-State: ALoCoQkDTjY9qnUiGl5u+w/lN/XZm0OEyz8Dw4Kp0N9QNG0qSB2SeJ8ljhsKBynLZOfX+4rQ+J6r X-Received: by 10.180.87.228 with SMTP id bb4mr4448820wib.3.1411737667568; Fri, 26 Sep 2014 06:21:07 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.80 with SMTP id v16ls384148laz.21.gmail; Fri, 26 Sep 2014 06:21:07 -0700 (PDT) X-Received: by 10.152.19.225 with SMTP id i1mr20285692lae.21.1411737667415; Fri, 26 Sep 2014 06:21:07 -0700 (PDT) Received: from mail-lb0-f180.google.com (mail-lb0-f180.google.com [209.85.217.180]) by mx.google.com with ESMTPS id kx10si7081643lac.130.2014.09.26.06.21.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 26 Sep 2014 06:21:07 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 as permitted sender) client-ip=209.85.217.180; Received: by mail-lb0-f180.google.com with SMTP id f15so1021692lbj.39 for ; Fri, 26 Sep 2014 06:21:07 -0700 (PDT) X-Received: by 10.112.200.134 with SMTP id js6mr19210040lbc.0.1411737667150; Fri, 26 Sep 2014 06:21:07 -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.112.130.169 with SMTP id of9csp59444lbb; Fri, 26 Sep 2014 06:21:06 -0700 (PDT) X-Received: by 10.68.94.34 with SMTP id cz2mr30979793pbb.7.1411737665602; Fri, 26 Sep 2014 06:21:05 -0700 (PDT) Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id c7si9105980pdo.242.2014.09.26.06.21.04 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 26 Sep 2014 06:21:05 -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 1XXVQu-0004FW-7T; Fri, 26 Sep 2014 13:19:36 +0000 Received: from mail-lb0-f182.google.com ([209.85.217.182]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XXVPU-0002cE-7N for linux-arm-kernel@lists.infradead.org; Fri, 26 Sep 2014 13:18:08 +0000 Received: by mail-lb0-f182.google.com with SMTP id z11so2637704lbi.41 for ; Fri, 26 Sep 2014 06:17:45 -0700 (PDT) X-Received: by 10.112.43.108 with SMTP id v12mr15410453lbl.43.1411737465748; Fri, 26 Sep 2014 06:17:45 -0700 (PDT) Received: from localhost.localdomain (188-178-240-98-static.dk.customer.tdc.net. [188.178.240.98]) by mx.google.com with ESMTPSA id z4sm1876657laz.39.2014.09.26.06.17.43 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 26 Sep 2014 06:17:44 -0700 (PDT) From: Christoffer Dall To: Paolo Bonzini , Gleb Natapov Subject: [PATCH 06/27] KVM: ARM/arm64: return -EFAULT if copy_from_user fails in set_timer_reg Date: Fri, 26 Sep 2014 15:16:39 +0200 Message-Id: <1411737420-9063-7-git-send-email-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1411737420-9063-1-git-send-email-christoffer.dall@linaro.org> References: <1411737420-9063-1-git-send-email-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140926_061808_494818_18211034 X-CRM114-Status: GOOD ( 12.20 ) X-Spam-Score: -0.7 (/) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-0.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.217.182 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RCVD_IN_MSPIKE_H3 RBL: Good reputation (+3) [209.85.217.182 listed in wl.mailspike.net] -0.0 RCVD_IN_MSPIKE_WL Mailspike good senders Cc: kvm@vger.kernel.org, Marc Zyngier , Will Deacon , Christoffer Dall , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org 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: christoffer.dall@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.180 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 From: Will Deacon We currently return the number of bytes not copied if set_timer_reg fails, which is almost certainly not what userspace would like. This patch returns -EFAULT instead. Cc: Christoffer Dall Cc: Marc Zyngier Signed-off-by: Will Deacon Signed-off-by: Christoffer Dall --- arch/arm/kvm/guest.c | 2 +- arch/arm64/kvm/guest.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/arch/arm/kvm/guest.c b/arch/arm/kvm/guest.c index 813e492..cc0b787 100644 --- a/arch/arm/kvm/guest.c +++ b/arch/arm/kvm/guest.c @@ -163,7 +163,7 @@ static int set_timer_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) ret = copy_from_user(&val, uaddr, KVM_REG_SIZE(reg->id)); if (ret != 0) - return ret; + return -EFAULT; return kvm_arm_timer_set_reg(vcpu, reg->id, val); } diff --git a/arch/arm64/kvm/guest.c b/arch/arm64/kvm/guest.c index 8d1ec28..7679469 100644 --- a/arch/arm64/kvm/guest.c +++ b/arch/arm64/kvm/guest.c @@ -174,7 +174,7 @@ static int set_timer_reg(struct kvm_vcpu *vcpu, const struct kvm_one_reg *reg) ret = copy_from_user(&val, uaddr, KVM_REG_SIZE(reg->id)); if (ret != 0) - return ret; + return -EFAULT; return kvm_arm_timer_set_reg(vcpu, reg->id, val); }