diff options
author | Jan Beulich <jbeulich@suse.com> | 2013-02-04 12:03:38 +0100 |
---|---|---|
committer | Jan Beulich <jbeulich@suse.com> | 2013-02-04 12:03:38 +0100 |
commit | 29aede13d56f877b227e7afcd049e804b8a5a3ca (patch) | |
tree | 54c8a28b33f083b09d77ca61c6c4e2d1e6de4259 /xen/arch/x86/hvm/hvm.c | |
parent | e7dda8ec9fc9020e4f53345cdbb18a2e82e54a65 (diff) | |
download | xen-29aede13d56f877b227e7afcd049e804b8a5a3ca.tar.gz xen-29aede13d56f877b227e7afcd049e804b8a5a3ca.tar.bz2 xen-29aede13d56f877b227e7afcd049e804b8a5a3ca.zip |
x86/nestedhvm: properly clean up after failure to set up all vCPU-s
This implies that the individual destroy functions will have to remain
capable of being called for a vCPU that the corresponding init function
was never run on.
Once at it, also clean up some inefficiencies in the corresponding
parameter validation code.
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Acked-by: Keir Fraser <keir@xen.org>
Diffstat (limited to 'xen/arch/x86/hvm/hvm.c')
-rw-r--r-- | xen/arch/x86/hvm/hvm.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/xen/arch/x86/hvm/hvm.c b/xen/arch/x86/hvm/hvm.c index 34b86f4f39..9a2d49e1af 100644 --- a/xen/arch/x86/hvm/hvm.c +++ b/xen/arch/x86/hvm/hvm.c @@ -3900,20 +3900,25 @@ long do_hvm_op(unsigned long op, XEN_GUEST_HANDLE_PARAM(void) arg) rc = -EPERM; break; } + if ( !a.value ) + break; if ( a.value > 1 ) rc = -EINVAL; - if ( !is_hvm_domain(d) ) - rc = -EINVAL; /* Remove the check below once we have * shadow-on-shadow. */ - if ( cpu_has_svm && !paging_mode_hap(d) && a.value ) + if ( cpu_has_svm && !paging_mode_hap(d) ) rc = -EINVAL; /* Set up NHVM state for any vcpus that are already up */ if ( !d->arch.hvm_domain.params[HVM_PARAM_NESTEDHVM] ) + { for_each_vcpu(d, v) if ( rc == 0 ) rc = nestedhvm_vcpu_initialise(v); + if ( rc ) + for_each_vcpu(d, v) + nestedhvm_vcpu_destroy(v); + } break; case HVM_PARAM_BUFIOREQ_EVTCHN: rc = -EINVAL; |