diff options
author | Marc Zyngier <marc.zyngier@arm.com> | 2013-04-17 15:09:09 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2013-04-17 15:51:32 -0400 |
commit | 15bbc1b28ff65767922f78c266821cc138b90a47 (patch) | |
tree | 419287be95672919211746e6657be7f56c19ab06 /arch/arm | |
parent | fca83168aae6fa0c36a923ef99311587ad5b54f2 (diff) |
ARM: KVM: fix unbalanced get_cpu() in access_dcsw
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>
Diffstat (limited to 'arch/arm')
-rw-r--r-- | arch/arm/kvm/coproc.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/arch/arm/kvm/coproc.c b/arch/arm/kvm/coproc.c index 4ea9a982269c..7bed7556077a 100644 --- a/arch/arm/kvm/coproc.c +++ b/arch/arm/kvm/coproc.c | |||
@@ -79,11 +79,11 @@ static bool access_dcsw(struct kvm_vcpu *vcpu, | |||
79 | u32 val; | 79 | u32 val; |
80 | int cpu; | 80 | int cpu; |
81 | 81 | ||
82 | cpu = get_cpu(); | ||
83 | |||
84 | if (!p->is_write) | 82 | if (!p->is_write) |
85 | return read_from_write_only(vcpu, p); | 83 | return read_from_write_only(vcpu, p); |
86 | 84 | ||
85 | cpu = get_cpu(); | ||
86 | |||
87 | cpumask_setall(&vcpu->arch.require_dcache_flush); | 87 | cpumask_setall(&vcpu->arch.require_dcache_flush); |
88 | cpumask_clear_cpu(cpu, &vcpu->arch.require_dcache_flush); | 88 | cpumask_clear_cpu(cpu, &vcpu->arch.require_dcache_flush); |
89 | 89 | ||