Skip to content

Commit

Permalink
KVM: take kvm_lock for hardware_disable() during cpu hotplug
Browse files Browse the repository at this point in the history
In kvm_cpu_hotplug(), only CPU_STARTING case is protected by kvm_lock.
This patch adds missing protection for CPU_DYING case.

Signed-off-by: Takuya Yoshikawa <[email protected]>
Signed-off-by: Marcelo Tosatti <[email protected]>
  • Loading branch information
Takuya Yoshikawa authored and avikivity committed Jan 12, 2011
1 parent e730b63 commit 97e91e2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions virt/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2140,7 +2140,9 @@ static int kvm_cpu_hotplug(struct notifier_block *notifier, unsigned long val,
case CPU_DYING:
printk(KERN_INFO "kvm: disabling virtualization on CPU%d\n",
cpu);
spin_lock(&kvm_lock);
hardware_disable(NULL);
spin_unlock(&kvm_lock);
break;
case CPU_STARTING:
printk(KERN_INFO "kvm: enabling virtualization on CPU%d\n",
Expand Down

0 comments on commit 97e91e2

Please sign in to comment.