public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
From: Punit Agrawal <punit.agrawal@arm.com>
To: stable@vger.kernel.org
Cc: ioana.ciornei@nxp.com, Punit Agrawal <punit.agrawal@arm.com>,
	Marc Zyngier <marc.zyngier@arm.com>,
	Christoffer Dall <christoffer.dall@linaro.org>
Subject: [PATCH] KVM: arm/arm64: Fix check for hugepage size when allocating at Stage 2
Date: Wed, 28 Feb 2018 16:40:09 +0000	[thread overview]
Message-ID: <20180228164009.3907-1-punit.agrawal@arm.com> (raw)

Commit 45ee9d5e97a4 ("KVM: arm/arm64: Check pagesize when allocating a
hugepage at Stage 2") lost the check for PMD_SIZE during the backport
to 4.9.

Fix this by correcting the condition to detect hugepages during stage
2 allocation.

Fixes: 45ee9d5e97a4 ("KVM: arm/arm64: Check pagesize when allocating a hugepage at Stage 2")
Reported-by: Ioana Ciornei <ioana.ciornei@nxp.com>
Signed-off-by: Punit Agrawal <punit.agrawal@arm.com>
Cc: Marc Zyngier <marc.zyngier@arm.com>
Cc: Christoffer Dall <christoffer.dall@linaro.org>
--
Hi Greg,

This patch fixes a commit in the stable tree that was backported from
upstream. I am not sure what the tag convention is for such a commit -
so sending as a fix.

Thanks,
Punit
---
 arch/arm/kvm/mmu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/kvm/mmu.c b/arch/arm/kvm/mmu.c
index 2a35c1963f6d..7f868d9bb5ed 100644
--- a/arch/arm/kvm/mmu.c
+++ b/arch/arm/kvm/mmu.c
@@ -1284,7 +1284,7 @@ static int user_mem_abort(struct kvm_vcpu *vcpu, phys_addr_t fault_ipa,
 		return -EFAULT;
 	}
 
-	if (vma_kernel_pagesize(vma) && !logging_active) {
+	if (vma_kernel_pagesize(vma) == PMD_SIZE && !logging_active) {
 		hugetlb = true;
 		gfn = (fault_ipa & PMD_MASK) >> PAGE_SHIFT;
 	} else {
-- 
2.16.1

             reply	other threads:[~2018-02-28 16:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-02-28 16:40 Punit Agrawal [this message]
2018-02-28 17:45 ` Patch "KVM: arm/arm64: Fix check for hugepage size when allocating at Stage 2" has been added to the 4.9-stable tree gregkh
2018-02-28 17:45 ` [PATCH] KVM: arm/arm64: Fix check for hugepage size when allocating at Stage 2 Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180228164009.3907-1-punit.agrawal@arm.com \
    --to=punit.agrawal@arm.com \
    --cc=christoffer.dall@linaro.org \
    --cc=ioana.ciornei@nxp.com \
    --cc=marc.zyngier@arm.com \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox