diff options
author | Yoshimi Ichiyanagi <ichiyanagi.yoshimi@lab.ntt.co.jp> | 2007-01-05 19:36:24 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.osdl.org> | 2007-01-06 02:55:22 -0500 |
commit | e097f35ce58eb8d687f3a300247cf1a978fcea39 (patch) | |
tree | d6d35f79744a7ec1b507c26b00ffd76effd1198e /drivers | |
parent | d3b2c33860d4acdfe3ac29b40b03e655eb8d1e2c (diff) |
[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>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/kvm/kvm_main.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index ce7fe640f18d..b54caf0ceeb1 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c | |||
@@ -1944,17 +1944,17 @@ int kvm_init_arch(struct kvm_arch_ops *ops, struct module *module) | |||
1944 | return -EEXIST; | 1944 | return -EEXIST; |
1945 | } | 1945 | } |
1946 | 1946 | ||
1947 | kvm_arch_ops = ops; | 1947 | if (!ops->cpu_has_kvm_support()) { |
1948 | |||
1949 | if (!kvm_arch_ops->cpu_has_kvm_support()) { | ||
1950 | printk(KERN_ERR "kvm: no hardware support\n"); | 1948 | printk(KERN_ERR "kvm: no hardware support\n"); |
1951 | return -EOPNOTSUPP; | 1949 | return -EOPNOTSUPP; |
1952 | } | 1950 | } |
1953 | if (kvm_arch_ops->disabled_by_bios()) { | 1951 | if (ops->disabled_by_bios()) { |
1954 | printk(KERN_ERR "kvm: disabled by bios\n"); | 1952 | printk(KERN_ERR "kvm: disabled by bios\n"); |
1955 | return -EOPNOTSUPP; | 1953 | return -EOPNOTSUPP; |
1956 | } | 1954 | } |
1957 | 1955 | ||
1956 | kvm_arch_ops = ops; | ||
1957 | |||
1958 | r = kvm_arch_ops->hardware_setup(); | 1958 | r = kvm_arch_ops->hardware_setup(); |
1959 | if (r < 0) | 1959 | if (r < 0) |
1960 | return r; | 1960 | return r; |