[Devel] [PATCH RHEL7 COMMIT] kvm: fix struct kvm leak on VM stop in mmu_shrink_scan()

Konstantin Khorenko khorenko at virtuozzo.com
Mon Dec 9 19:01:09 MSK 2019


The commit is pushed to "branch-rh7-3.10.0-1062.7.1.vz7.130.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1062.7.1.vz7.130.2
------>
commit 46b803f54718330db7e46c6379fae686913f38b6
Author: Konstantin Khorenko <khorenko at virtuozzo.com>
Date:   Mon Dec 9 18:57:22 2019 +0300

    kvm: fix struct kvm leak on VM stop in mmu_shrink_scan()
    
    During rebase from vz7.115.x to vz7.116.x branch
    i've lost part of the hunk of 0a84eff1d602 ("kvm: fix race between
    mmu_shrink_scan() and VM destroy") and introduced struct kvm leak.
    
    Need to drop extra kvm_get_kvm().
    
    Fixes: 35c788e991f0 ("kvm: fix race between mmu_shrink_scan() and VM
    destroy")
    
    https://jira.sw.ru/browse/PSBM-100158
    
    Reported-by: Vasily Averin <vvs at virtuozzo.com>
    Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
---
 arch/x86/kvm/mmu.c | 1 -
 1 file changed, 1 deletion(-)

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 1f6040bc76f5..5cbd5e9f50d8 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -5877,7 +5877,6 @@ mmu_shrink_scan(struct shrinker *shrink, struct shrink_control *sc)
 		      !kvm_has_zapped_obsolete_pages(kvm))
 			continue;
 
-		kvm_get_kvm(kvm);
 		/*
 		 * If try_get fails, we race with last kvm_put_kvm(),
 		 * so skip the VM, it will die soon anyway.



More information about the Devel mailing list