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)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 28 Apr 2014 11:04:46 +0000 (13:04 +0200)
commit41c22f626254b9dc0376928cae009e73d1b6a49a
tree6c3318644f52be8cff8ddc91c12773465a394060
parent5c8818b46e067120d33bbb2f610313240d76ba02
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>
virt/kvm/async_pf.c