From: Wei Yongjun <[email protected]>

commit ad05c88266b4cce1c820928ce8a0fb7690912ba1
(KVM: create aggregate kvm_total_used_mmu_pages value)
introduce percpu counter kvm_total_used_mmu_pages but never
destroy it, this may cause oops when rmmod & modprobe.

Signed-off-by: Wei Yongjun <[email protected]>
Acked-by: Tim Pepper <[email protected]>
Signed-off-by: Marcelo Tosatti <[email protected]>

diff --git a/arch/x86/kvm/mmu.c b/arch/x86/kvm/mmu.c
index 0991de3..c1d5f59 100644
--- a/arch/x86/kvm/mmu.c
+++ b/arch/x86/kvm/mmu.c
@@ -3189,6 +3189,7 @@ static void mmu_destroy_caches(void)
 void kvm_mmu_module_exit(void)
 {
        mmu_destroy_caches();
+       percpu_counter_destroy(&kvm_total_used_mmu_pages);
        unregister_shrinker(&mmu_shrinker);
 }
 
@@ -3211,7 +3212,9 @@ int kvm_mmu_module_init(void)
        if (!mmu_page_header_cache)
                goto nomem;
 
-       percpu_counter_init(&kvm_total_used_mmu_pages, 0);
+       if (percpu_counter_init(&kvm_total_used_mmu_pages, 0))
+               goto nomem;
+
        register_shrinker(&mmu_shrinker);
 
        return 0;
--
To unsubscribe from this list: send the line "unsubscribe kvm-commits" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to