Patchwork KVM: NULL return of kvmppc_mmu_hpte_cache_next should be handled

login
register
mail settings
Submitter Zhouyi Zhou
Date Dec. 2, 2013, 10:21 a.m.
Message ID <1385979718-26218-1-git-send-email-yizhouzhou@ict.ac.cn>
Download mbox | patch
Permalink /patch/295861/
State New
Headers show

Comments

Zhouyi Zhou - Dec. 2, 2013, 10:21 a.m.
NULL return of kvmppc_mmu_hpte_cache_next should be handled

Signed-off-by: Zhouyi Zhou <yizhouzhou@ict.ac.cn>
---
 arch/powerpc/kvm/book3s_32_mmu_host.c |    5 +++++
 1 file changed, 5 insertions(+)
Alexander Graf - Jan. 2, 2014, 8:39 p.m.
On 02.12.2013, at 11:21, Zhouyi Zhou <zhouzhouyi@gmail.com> wrote:

> NULL return of kvmppc_mmu_hpte_cache_next should be handled
> 
> Signed-off-by: Zhouyi Zhou <yizhouzhou@ict.ac.cn>

Thanks, applied to kvm-ppc-queue.


Alex

--
To unsubscribe from this list: send the line "unsubscribe kvm-ppc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/arch/powerpc/kvm/book3s_32_mmu_host.c b/arch/powerpc/kvm/book3s_32_mmu_host.c
index 3a0abd2..5fac89d 100644
--- a/arch/powerpc/kvm/book3s_32_mmu_host.c
+++ b/arch/powerpc/kvm/book3s_32_mmu_host.c
@@ -243,6 +243,11 @@  next_pteg:
 	/* Now tell our Shadow PTE code about the new page */
 
 	pte = kvmppc_mmu_hpte_cache_next(vcpu);
+	if (!pte) {
+		kvm_release_pfn_clean(hpaddr >> PAGE_SHIFT);
+		r = -EAGAIN;
+		goto out;
+	}
 
 	dprintk_mmu("KVM: %c%c Map 0x%llx: [%lx] 0x%llx (0x%llx) -> %lx\n",
 		    orig_pte->may_write ? 'w' : '-',