Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Yoshimi Ichiyanagi and committed by
Linus Torvalds
e097f35c d3b2c338

+4 -4
+4 -4
drivers/kvm/kvm_main.c
··· 1944 1944 return -EEXIST; 1945 1945 } 1946 1946 1947 - kvm_arch_ops = ops; 1948 - 1949 - if (!kvm_arch_ops->cpu_has_kvm_support()) { 1947 + if (!ops->cpu_has_kvm_support()) { 1950 1948 printk(KERN_ERR "kvm: no hardware support\n"); 1951 1949 return -EOPNOTSUPP; 1952 1950 } 1953 - if (kvm_arch_ops->disabled_by_bios()) { 1951 + if (ops->disabled_by_bios()) { 1954 1952 printk(KERN_ERR "kvm: disabled by bios\n"); 1955 1953 return -EOPNOTSUPP; 1956 1954 } 1955 + 1956 + kvm_arch_ops = ops; 1957 1957 1958 1958 r = kvm_arch_ops->hardware_setup(); 1959 1959 if (r < 0)