MIPS: KVM: Fix preemptable kvm_mips_get_*_asid() calls
authorJames Hogan <james.hogan@imgtec.com>
Fri, 22 Apr 2016 09:38:47 +0000 (10:38 +0100)
committerPaolo Bonzini <pbonzini@redhat.com>
Tue, 10 May 2016 13:56:51 +0000 (15:56 +0200)
commitf049729c05cc5338174d52e2bee6678131da5e08
treeaec6e28521d00a1dba684dc5d652e571e4b2aa9b
parentb45bacd2d048f405c7760e5cc9b60dd67708734f
MIPS: KVM: Fix preemptable kvm_mips_get_*_asid() calls

There are a couple of places in KVM fault handling code which implicitly
use smp_processor_id() via kvm_mips_get_kernel_asid() and
kvm_mips_get_user_asid() from preemptable context. This is unsafe as a
preemption could cause the guest kernel ASID to be changed, resulting in
a host TLB entry being written with the wrong ASID.

Fix by disabling preemption around the kvm_mips_get_*_asid() call and
the corresponding kvm_mips_host_tlb_write().

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Radim KrÄ\8dmář" <rkrcmar@redhat.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: linux-mips@linux-mips.org
Cc: kvm@vger.kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
arch/mips/kvm/tlb.c