Skip to content

Commit

Permalink
KVM: Explicity initialize cpus_hardware_enabled
Browse files Browse the repository at this point in the history
Under CONFIG_MAXSMP, cpus_hardware_enabled is allocated from the heap and
not statically initialized.  This causes a crash on reboot when kvm thinks
vmx is enabled on random nonexistent cpus and accesses nonexistent percpu
lists.

Fix by explicitly clearing the variable.

Cc: [email protected]
Reported-and-tested-by: Yinghai Lu <[email protected]>
Signed-off-by: Avi Kivity <[email protected]>
  • Loading branch information
avikivity committed Jun 8, 2009
1 parent ccc0d38 commit a4c0364
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions virt/kvm/kvm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2305,6 +2305,7 @@ int kvm_init(void *opaque, unsigned int vcpu_size,
r = -ENOMEM;
goto out_free_0;
}
cpumask_clear(cpus_hardware_enabled);

r = kvm_arch_hardware_setup();
if (r < 0)
Expand Down

0 comments on commit a4c0364

Please sign in to comment.