On 10/24/25 7:08 PM, Andrew Cooper wrote:
On 24/10/2025 5:20 pm, Ross Lagerwall wrote:
If nested vCPU initialization fails, cleanup the allocated memory since
it is no longer handled by the caller.

Fixes: c47984aabead ("nvmx: implement support for MSR bitmaps")
Fixes: f5bdb4aaa165 ("x86/hvm: Obsolete the use of HVM_PARAM_NESTEDHVM")
Signed-off-by: Ross Lagerwall <[email protected]>

AFAICT, this is because of hvm_vcpu_initialise() not calling
nestedhvm_vcpu_destroy() if nestedhvm_vcpu_initialise() fails?

I think this is an improvement in the short term, but we really need to
fix our object lifecycle.  Relatedly, I should dust off the fault-ttl
series because it would be able to find this failure automatically.

~Andrew

Having hvm_vcpu_initialise() call nestedhvm_vcpu_destroy() would be one way of fixing it (albeit it is complicated because some cleanup is also done in vcpu_relinquish_resources()). But IMO generally a partial failure of an initialization function should be handled up internally rather than expecting the caller to deal with it.

Ross

Reply via email to