KVM: async_pf: mm->mm_users can not pin apf->mm
authorOleg Nesterov <oleg@redhat.com>
Mon, 21 Apr 2014 13:26:01 +0000 (15:26 +0200)
committerChristoffer Dall <christoffer.dall@linaro.org>
Thu, 2 Oct 2014 15:18:40 +0000 (17:18 +0200)
commit6e349e33cec7724f9ae0520a1539ab7cf1d24893
tree7b90ad48720e662391961f7e60a63586a000e0dc
parent738a77ae39541495f4d5396ed093bccdebc589f1
KVM: async_pf: mm->mm_users can not pin apf->mm

get_user_pages(mm) is simply wrong if mm->mm_users == 0 and exit_mmap/etc
was already called (or is in progress), mm->mm_count can only pin mm->pgd
and mm_struct itself.

Change kvm_setup_async_pf/async_pf_execute to inc/dec mm->mm_users.

kvm_create_vm/kvm_destroy_vm play with ->mm_count too but this case looks
fine at first glance, it seems that this ->mm is only used to verify that
current->mm == kvm->mm.

Signed-off-by: Oleg Nesterov <oleg@redhat.com>
Cc: stable@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
(cherry picked from commit 41c22f626254b9dc0376928cae009e73d1b6a49a)
Signed-off-by: Christoffer Dall <christoffer.dall@linaro.org>
virt/kvm/async_pf.c