On 23.06.2025 03:16, dm...@proton.me wrote:
> From: Denis Mukhin <dmuk...@ford.com>
> 
> Fix potential memory leak in domain_create() in late hardware domain case.
> 
> Fixes: b959f3b820f5 ("xen: introduce hardware domain create flag")
> Signed-off-by: Denis Mukhin <dmuk...@ford.com>

Reviewed-by: Jan Beulich <jbeul...@suse.com>

It may be relevant to mention that we still can't very well use "goto fail"
on this error path, as insufficient struct initialization was done just yet.

What we may want to consider is to move down the get_unique_id() invocation.
It's not the end of the world to lose one, but that may better be avoided
when we easily can.

> ---
> I think that no memory allocation is required before performing late hwdom
> checks (ID range and hwdom existance).
> 
> Looks like sanitise_domain_config() could better fit for performing such
> configuration checks.
> 
> Alternatively, hardware_domid range could be checked via custom parser
> instead of code in domain_create() and then hwdom existance can be moved
> before alloc_domain_struct().
> 
> Thoughts?

Keeping related things together is the other desire we commonly have.

Jan

Reply via email to