]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
ARM: KVM: fix unbalanced get_cpu() in access_dcsw
authorMarc Zyngier <marc.zyngier@arm.com>
Wed, 17 Apr 2013 19:09:09 +0000 (12:09 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 17 Apr 2013 19:51:32 +0000 (12:51 -0700)
In the very unlikely event where a guest would be foolish enough to
*read* from a write-only cache maintainance register, we end up
with preemption disabled, due to a misplaced get_cpu().

Just move the "is_write" test outside of the critical section.

Signed-off-by: Marc Zyngier <marc.zyngier@arm.com>
Signed-off-by: Christoffer Dall <cdall@cs.columbia.edu>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/arm/kvm/coproc.c

index 4ea9a982269c8f9c9c56808f92b464a025356533..7bed7556077a20002f0e1a6cea2c5a43b05b9102 100644 (file)
@@ -79,11 +79,11 @@ static bool access_dcsw(struct kvm_vcpu *vcpu,
        u32 val;
        int cpu;
 
-       cpu = get_cpu();
-
        if (!p->is_write)
                return read_from_write_only(vcpu, p);
 
+       cpu = get_cpu();
+
        cpumask_setall(&vcpu->arch.require_dcache_flush);
        cpumask_clear_cpu(cpu, &vcpu->arch.require_dcache_flush);