Skip to content

Commit

Permalink
ARM: KVM: fix unbalanced get_cpu() in access_dcsw
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Marc Zyngier authored and Linus Torvalds committed Apr 17, 2013
1 parent fca8316 commit 15bbc1b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions arch/arm/kvm/coproc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit 15bbc1b

Please sign in to comment.