[PATCH] KVM: Recover after an arch module load failure

If we load the wrong arch module, it leaves behind kvm_arch_ops set, which
prevents loading of the correct arch module later.

Fix be not setting kvm_arch_ops until we're sure it's good.

Signed-off-by: Yoshimi Ichiyanagi <ichiyanagi.yoshimi@lab.ntt.co.jp>
Signed-off-by: Avi Kivity <avi@qumranet.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Yoshimi Ichiyanagi 2007-01-05 16:36:24 -08:00 committed by Linus Torvalds
parent d3b2c33860
commit e097f35ce5
1 changed files with 4 additions and 4 deletions

View File

@ -1944,17 +1944,17 @@ int kvm_init_arch(struct kvm_arch_ops *ops, struct module *module)
return -EEXIST; return -EEXIST;
} }
kvm_arch_ops = ops; if (!ops->cpu_has_kvm_support()) {
if (!kvm_arch_ops->cpu_has_kvm_support()) {
printk(KERN_ERR "kvm: no hardware support\n"); printk(KERN_ERR "kvm: no hardware support\n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
if (kvm_arch_ops->disabled_by_bios()) { if (ops->disabled_by_bios()) {
printk(KERN_ERR "kvm: disabled by bios\n"); printk(KERN_ERR "kvm: disabled by bios\n");
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
kvm_arch_ops = ops;
r = kvm_arch_ops->hardware_setup(); r = kvm_arch_ops->hardware_setup();
if (r < 0) if (r < 0)
return r; return r;