From: dmkhn@proton.me
To: Jan Beulich <jbeulich@suse.com>
Cc: andrew.cooper3@citrix.com, anthony.perard@vates.tech,
julien@xen.org, michal.orzel@amd.com, roger.pau@citrix.com,
sstabellini@kernel.org, dmukhin@ford.com,
xen-devel@lists.xenproject.org
Subject: Re: [PATCH v1] xen/domain: fix memory leak in domain_create()
Date: Tue, 24 Jun 2025 04:19:56 +0000 [thread overview]
Message-ID: <aFonaL0FNAHZoBYf@kraken> (raw)
In-Reply-To: <f4b2c2b1-c7af-44d8-878b-ef5a0facbebd@suse.com>
On Mon, Jun 23, 2025 at 10:09:54AM +0200, Jan Beulich wrote:
> On 23.06.2025 03:16, dmkhn@proton.me wrote:
> > From: Denis Mukhin <dmukhin@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 <dmukhin@ford.com>
>
> Reviewed-by: Jan Beulich <jbeulich@suse.com>
Thanks.
Just in case, I've seen the patch is committed as
3491e85a1505 ("xen/domain: fix memory leak in domain_create()")
but there's no R-b tag.
>
> 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.
Yeah, I see this is to avoid duplicated checks, but verifying hardware_domid
range definitely can be moved outside of domain_create()
This superfluous memory allocation will need a test case in cert world since
this is arch-common code :-/
So, IMO, it is better to avoid it.
>
> Jan
prev parent reply other threads:[~2025-06-24 4:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-23 1:16 [PATCH v1] xen/domain: fix memory leak in domain_create() dmkhn
2025-06-23 8:09 ` Jan Beulich
2025-06-24 4:19 ` dmkhn [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aFonaL0FNAHZoBYf@kraken \
--to=dmkhn@proton.me \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@vates.tech \
--cc=dmukhin@ford.com \
--cc=jbeulich@suse.com \
--cc=julien@xen.org \
--cc=michal.orzel@amd.com \
--cc=roger.pau@citrix.com \
--cc=sstabellini@kernel.org \
--cc=xen-devel@lists.xenproject.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.