From: Peter Xu <peterx@redhat.com>
To: Trieu Huynh <vikingtc4@gmail.com>
Cc: qemu-devel@nongnu.org, Fabiano Rosas <farosas@suse.de>,
Laurent Vivier <lvivier@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>
Subject: Re: [PATCH] tests/qtest/migration: fix fd leak in ufd_version_check
Date: Mon, 20 Apr 2026 15:57:56 -0400 [thread overview]
Message-ID: <aeaFRFbJ3uInmVKE@x1.local> (raw)
In-Reply-To: <20260419110304.8661-1-viking4@gmail.com>
On Sun, Apr 19, 2026 at 06:03:04PM +0700, Trieu Huynh wrote:
> From: Trieu Huynh <vikingtc4@gmail.com>
>
> ufd_version_check() opens a userfaultfd via uffd_open() but never closes
> it on any path where the open succeeded: the UFFDIO_API failure path,
> the missing-ioctls path, and the success path all returned without
> calling close(ufd).
>
> Convert to a goto-out pattern consistent with uffd_open() used in
> util/userfaultfd.c and migration/postcopy-ram.c, ensuring the fd is
> always closed before returning.
>
> Signed-off-by: Trieu Huynh <vikingtc4@gmail.com>
Thanks,
Reviewed-by: Peter Xu <peterx@redhat.com>
--
Peter Xu
prev parent reply other threads:[~2026-04-20 19:58 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-19 11:03 [PATCH] tests/qtest/migration: fix fd leak in ufd_version_check Trieu Huynh
2026-04-20 19:57 ` Peter Xu [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=aeaFRFbJ3uInmVKE@x1.local \
--to=peterx@redhat.com \
--cc=farosas@suse.de \
--cc=lvivier@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=vikingtc4@gmail.com \
/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.