Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit e097f35c authored by Yoshimi Ichiyanagi's avatar Yoshimi Ichiyanagi Committed by Linus Torvalds
Browse files

[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: default avatarYoshimi Ichiyanagi <ichiyanagi.yoshimi@lab.ntt.co.jp>
Signed-off-by: default avatarAvi Kivity <avi@qumranet.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent d3b2c338
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -1944,17 +1944,17 @@ int kvm_init_arch(struct kvm_arch_ops *ops, struct module *module)
		return -EEXIST;
	}

	kvm_arch_ops = ops;

	if (!kvm_arch_ops->cpu_has_kvm_support()) {
	if (!ops->cpu_has_kvm_support()) {
		printk(KERN_ERR "kvm: no hardware support\n");
		return -EOPNOTSUPP;
	}
	if (kvm_arch_ops->disabled_by_bios()) {
	if (ops->disabled_by_bios()) {
		printk(KERN_ERR "kvm: disabled by bios\n");
		return -EOPNOTSUPP;
	}

	kvm_arch_ops = ops;

	r = kvm_arch_ops->hardware_setup();
	if (r < 0)
	    return r;