Marc Zyngier  committed 15bbc1b

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 <>
Signed-off-by: Christoffer Dall <>
Signed-off-by: Linus Torvalds <>

  • Participants
  • Parent commits fca8316

Comments (0)

Files changed (1)

File arch/arm/kvm/coproc.c

 	u32 val;
 	int cpu;
-	cpu = get_cpu();
 	if (!p->is_write)
 		return read_from_write_only(vcpu, p);
+	cpu = get_cpu();
 	cpumask_clear_cpu(cpu, &vcpu->arch.require_dcache_flush);