On Wed, Aug 19, 2026 at 09:01:53PM +0300, Vladimir Sementsov-Ogievskiy wrote:
> Both fd_connect_outgoing() and fd_connect_incoming() own the file
> descriptor after resolving it from the monitor, but forget to close
> it when migration_fd_valid() check fails.
> 
> Signed-off-by: Vladimir Sementsov-Ogievskiy <[email protected]>

Oops.. thanks for fixing.

Reviewed-by: Peter Xu <[email protected]>

Cc: qemu-stable <[email protected]>
Fixes: f1fcc1c101 ("migration: Remove fd: support on files")

> ---
>  migration/fd.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/migration/fd.c b/migration/fd.c
> index f05f95992f8..02b39b150eb 100644
> --- a/migration/fd.c
> +++ b/migration/fd.c
> @@ -62,6 +62,7 @@ QIOChannel *fd_connect_outgoing(MigrationState *s, const 
> char *fdname,
>      if (!migration_fd_valid(fd)) {
>          error_setg(errp, "fd: migration to a file is not supported."
>                     " Use file: instead.");
> +        close(fd);
>          goto out;
>      }
>  
> @@ -97,6 +98,7 @@ void fd_connect_incoming(const char *fdname, Error **errp)
>      if (!migration_fd_valid(fd)) {
>          error_setg(errp, "fd: migration to a file is not supported."
>                     " Use file: instead.");
> +        close(fd);
>          return;
>      }
>  
> -- 
> 2.43.0
> 

-- 
Peter Xu


Reply via email to