From: Anthony PERARD <anthony.perard@citrix.com>
To: Dario Faggioli <dfaggioli@suse.com>
Cc: <xen-devel@lists.xenproject.org>, James Fehlig <jfehlig@suse.com>,
Wei Liu <wl@xen.org>, Juergen Gross <jgross@suse.com>
Subject: Re: [PATCH 1/2] tools/libs/light: numa placement: don't try to free a NULL list of vcpus
Date: Thu, 13 Jan 2022 12:05:34 +0000 [thread overview]
Message-ID: <YeAVjpmuV9LIRFpa@perard> (raw)
In-Reply-To: <164200569629.24755.2980883411590685040.stgit@work>
On Wed, Jan 12, 2022 at 05:41:36PM +0100, Dario Faggioli wrote:
> If libxl_vcpu_list() returned NULL, we should not call
> libxl_numainfo_list_free() as:
You mean libxl_vcpuinfo_list_free() ?
> 1) it'll fail trying to (double) free() *list
This isn't really an issue. free(NULL) is legit, can be call as many
time as you want.
> 2) there should be nothing to free anyway
The issue here is that it doesn't appear to be true. Even if "info" is
NULL, "nr" have an other value than 0, so libxl_vcpuinfo_list_free()
will try to access random addresses.
> Signed-off-by: Dario Faggioli <dfaggioli@suse.com>
> Tested-by: James Fehlig <jfehlig@suse.com>
Can I suggest to make libxl_vcpuinfo_list_free() work a bit better in
case it's "nr" parameter is wrong? It will do nothing if "list" is NULL.
Even if that seems wrong, and the caller should use the correct value.
Also I think it is better to keep the free in the exit path at the end
of the loop.
Thanks,
--
Anthony PERARD
next prev parent reply other threads:[~2022-01-13 12:06 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-12 16:41 [PATCH 0/2] libs/light: fix a race when domain are destroied and created concurrently Dario Faggioli
2022-01-12 16:41 ` [PATCH 1/2] tools/libs/light: numa placement: don't try to free a NULL list of vcpus Dario Faggioli
2022-01-13 12:05 ` Anthony PERARD [this message]
2022-01-14 23:22 ` Dario Faggioli
2022-01-17 15:56 ` Anthony PERARD
2022-01-19 9:02 ` Dario Faggioli
2022-01-12 16:41 ` [PATCH 2/2] tools/libs/light: don't touch nr_vcpus_out if listing vcpus and returning NULL Dario Faggioli
2022-01-13 12:38 ` Anthony PERARD
2022-01-13 11:46 ` [PATCH 0/2] libs/light: fix a race when domain are destroied and created concurrently Dario Faggioli
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=YeAVjpmuV9LIRFpa@perard \
--to=anthony.perard@citrix.com \
--cc=dfaggioli@suse.com \
--cc=jfehlig@suse.com \
--cc=jgross@suse.com \
--cc=wl@xen.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.