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

Submitted by Konstantin Khorenko on Dec. 9, 2019, 4:01 p.m.

Details

Message ID 201912091601.xB9G16S7030849@finist-ce7.sw.ru
State New
Series "kvm: fix struct kvm leak on VM stop in mmu_shrink_scan()"
Headers show

Commit Message

Konstantin Khorenko Dec. 9, 2019, 4:01 p.m.
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@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@virtuozzo.com>
    Signed-off-by: Konstantin Khorenko <khorenko@virtuozzo.com>
---
 arch/x86/kvm/mmu.c | 1 -
 1 file changed, 1 deletion(-)

Patch hide | download patch | download mbox

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.