KVM: PPC: fix leakage of error page in kvmppc_patch_dcbz()
authorWei Yongjun <yjwei@cn.fujitsu.com>
Tue, 17 Aug 2010 02:08:52 +0000 (10:08 +0800)
committerAvi Kivity <avi@redhat.com>
Sun, 24 Oct 2010 08:51:05 +0000 (10:51 +0200)
Add kvm_release_page_clean() after is_error_page() to avoid
leakage of error page.

Signed-off-by: Wei Yongjun <yjwei@cn.fujitsu.com>
Signed-off-by: Avi Kivity <avi@redhat.com>
arch/powerpc/kvm/book3s.c

index eee97b5a740057f1ad7695355a67a948113d99ad..7656b6df0d8bcc934f1bb4507cad30b7001f314c 100644 (file)
@@ -455,8 +455,10 @@ static void kvmppc_patch_dcbz(struct kvm_vcpu *vcpu, struct kvmppc_pte *pte)
        int i;
 
        hpage = gfn_to_page(vcpu->kvm, pte->raddr >> PAGE_SHIFT);
-       if (is_error_page(hpage))
+       if (is_error_page(hpage)) {
+               kvm_release_page_clean(hpage);
                return;
+       }
 
        hpage_offset = pte->raddr & ~PAGE_MASK;
        hpage_offset &= ~0xFFFULL;