mirror of
https://github.com/xen-project/xen.git
synced 2026-10-29 18:50:05 +01:00
x86: fix resource leaks on arch_vcpu_create() error path
{hvm,pv}_vcpu_initialise() have always kind of been meant to be the
final possible source of errors in arch_vcpu_create(), hence not
requiring any unrolling of what they've done on the error path. (Of
course this may change once the various involved paths all have become
idempotent.)
But even beyond this aspect I think it is more logical to do policy
initialization ahead of the calling of these two functions, as they may
in principle want to access it.
Fixes: 4187f79dc7 ("x86/msr: introduce struct msr_vcpu_policy")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
This commit is contained in:
1 parent
01d687c9cd
commit
6a34e67c11
1 file changed
+3
-3
@@ -569,6 +569,9 @@ int arch_vcpu_create(struct vcpu *v)
|
||||
vmce_init_vcpu(v);
|
||||
|
||||
arch_vcpu_regs_init(v);
|
||||
|
||||
if ( (rc = init_vcpu_msr_policy(v)) )
|
||||
goto fail;
|
||||
}
|
||||
else if ( (rc = xstate_alloc_save_area(v)) != 0 )
|
||||
return rc;
|
||||
@@ -594,9 +597,6 @@ int arch_vcpu_create(struct vcpu *v)
|
||||
{
|
||||
vpmu_initialise(v);
|
||||
|
||||
if ( (rc = init_vcpu_msr_policy(v)) )
|
||||
goto fail;
|
||||
|
||||
cpuid_policy_updated(v);
|
||||
}
|
||||
|
||||
|
||||