From patchwork Wed Aug 17 19:38:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoffer Dall X-Patchwork-Id: 74129 Delivered-To: patch@linaro.org Received: by 10.140.29.52 with SMTP id a49csp2211qga; Wed, 17 Aug 2016 12:42:13 -0700 (PDT) X-Received: by 10.66.193.163 with SMTP id hp3mr16230812pac.73.1471462933855; Wed, 17 Aug 2016 12:42:13 -0700 (PDT) Return-Path: Received: from bombadil.infradead.org (bombadil.infradead.org. [2001:1868:205::9]) by mx.google.com with ESMTPS id zd7si604372pab.115.2016.08.17.12.42.13 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 17 Aug 2016 12:42:13 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) client-ip=2001:1868:205::9; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org; spf=pass (google.com: best guess record for domain of linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org designates 2001:1868:205::9 as permitted sender) smtp.mailfrom=linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org; dmarc=fail (p=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1ba6hk-0005qR-KK; Wed, 17 Aug 2016 19:40:48 +0000 Received: from mail-wm0-x236.google.com ([2a00:1450:400c:c09::236]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1ba6eW-0002dF-Sa for linux-arm-kernel@lists.infradead.org; Wed, 17 Aug 2016 19:37:33 +0000 Received: by mail-wm0-x236.google.com with SMTP id i5so2131681wmg.0 for ; Wed, 17 Aug 2016 12:37:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=BizZ30+4nRnXMdzL/Gz59MItApfuOGmO+WknlmWK42o=; b=bdQbgWaORKXAj2Ly7KPHew2dOos2mW4jZguF2CSwwLjUPXJREIO+tWxLRxm3RRF/mL UOdqaPBQDPiGLcl5YRpV/vPwqRtn8hCdPHbWaOgeaXLCqwDQ5h1Elh2qGhFt9HY/qpdF SFpoz+obTQCuqfCghvTy/nZGVQwjRm57OksnI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=BizZ30+4nRnXMdzL/Gz59MItApfuOGmO+WknlmWK42o=; b=UxGwgniyXhkYXtyjgL6PloEyhnPfbsqow+ktnv86aTuiV5tTLYH4HZ2bINmsyShJU2 QER8GbdJXSFx2GpSZNg3GkkUXTZlJVYeA9jK6Lgc5MnFxidbV+6mfsYzQCs44BjfTi5e 0fFfkLXvM3u3Uo0yINoMXNL8q1ctFjW6sJnoEdRd0/E4lH+o4xHYUkiHDT+5Sbf481AE g6umexoQTYEvTiQujGZ1rRzc89e3MmZCEsJU/8own8/GILqzsh7wbPFcyHolAc5a1zhD 5HzlTJwqA9XbK/ra3H1ilpViGkj4e4d+TZrFWgLwV3G5HgegNu/oizhDz/eDz8uha7ly 1xQw== X-Gm-Message-State: AEkoouvHLHwf1Da5mewPCeVmotB2Oubw1MLi+lotBRE+1nIsXVbThZWDZqkUQ2vnq8rJRGKq X-Received: by 10.28.56.3 with SMTP id f3mr26425204wma.59.1471462627231; Wed, 17 Aug 2016 12:37:07 -0700 (PDT) Received: from localhost.localdomain ([94.18.191.146]) by smtp.gmail.com with ESMTPSA id jv9sm26185622wjb.45.2016.08.17.12.37.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 17 Aug 2016 12:37:06 -0700 (PDT) From: Christoffer Dall To: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Subject: [PULL 08/12] KVM: arm/arm64: Change misleading use of is_error_pfn Date: Wed, 17 Aug 2016 21:38:55 +0200 Message-Id: <20160817193859.15726-9-christoffer.dall@linaro.org> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20160817193859.15726-1-christoffer.dall@linaro.org> References: <20160817193859.15726-1-christoffer.dall@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20160817_123729_220048_B7A940E0 X-CRM114-Status: GOOD ( 13.33 ) X-Spam-Score: -2.7 (--) X-Spam-Report: SpamAssassin version 3.4.0 on bombadil.infradead.org summary: Content analysis details: (-2.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [2a00:1450:400c:c09:0:0:0:236 listed in] [list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Marc Zyngier , Christoffer Dall , kvm@vger.kernel.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patch=linaro.org@lists.infradead.org When converting a gfn to a pfn, we call gfn_to_pfn_prot, which returns various kinds of error values. It turns out that is_error_pfn() only returns true when the gfn was found in a memory slot and could somehow not be used, but it does not return true if the gfn does not belong to any memory slot. Change use to is_error_noslot_pfn() which covers both cases. Note: Since we already check for kvm_is_error_hva(hva) explicitly in the caller of this function while holding the kvm->srcu lock protecting the memory slots, this should never be a problem, but nevertheless this change is warranted as it shows the intention of the code. Reported-by: James Hogan Signed-off-by: Christoffer Dall --- arch/arm/kvm/mmu.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) -- 2.9.0 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c index bda27b6..29d0b23 100644 --- a/arch/arm/kvm/mmu.c +++ b/arch/arm/kvm/mmu.c @@ -1309,7 +1309,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa, smp_rmb(); pfn = gfn_to_pfn_prot(kvm, gfn, write_fault, &writable); - if (is_error_pfn(pfn)) + if (is_error_noslot_pfn(pfn)) return -EFAULT; if (kvm_is_device_pfn(pfn)) {