All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Daniel P. Berrangé" <berrange@redhat.com>
To: Wei Wang <wei.wang@smartx.com>
Cc: qemu-devel@nongnu.org, kkostiuk@redhat.com, michael.roth@amd.com
Subject: Re: [PATCH] qga: Fix crash due to redundant error setting in qmp_guest_file_open()
Date: Thu, 22 Jan 2026 08:50:59 +0000	[thread overview]
Message-ID: <aXHk8wPrQe6VLW-C@redhat.com> (raw)
In-Reply-To: <20260122040430.51001-1-wei.wang@smartx.com>

On Thu, Jan 22, 2026 at 12:04:30PM +0800, Wei Wang wrote:
> Avoid setting GError multiple times in qmp_guest_file_open() by checking
> if errp is already set.
> This prevents crash caused by repeated error handling calls.
> 
> Signed-off-by: Wei Wang <wei.wang@smartx.com>
> ---
>  qga/commands-win32.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/qga/commands-win32.c b/qga/commands-win32.c
> index 0fd0c966e4..8c45ca5004 100644
> --- a/qga/commands-win32.c
> +++ b/qga/commands-win32.c
> @@ -263,7 +263,9 @@ int64_t qmp_guest_file_open(const char *path, const char *mode, Error **errp)
>      fd = guest_file_handle_add(fh, errp);
>      if (fd < 0) {
>          CloseHandle(fh);
> -        error_setg(errp, "failed to add handle to qmp handle table");
> +        if (!*errp) {
> +            error_setg(errp, "failed to add handle to qmp handle table");
> +        }

guest_file_handle_add() only returns -1 when qga_get_fd_handle
returns -1, and qga_get_fd_handle always sets errp.

Therefore, your new conditional call to error_setg will never be
executed; remove it entirely.

With regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|



  reply	other threads:[~2026-01-22  8:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-22  4:04 [PATCH] qga: Fix crash due to redundant error setting in qmp_guest_file_open() Wei Wang
2026-01-22  8:50 ` Daniel P. Berrangé [this message]
2026-01-22  8:57 ` Markus Armbruster
2026-01-22  9:01   ` Kostiantyn Kostiuk

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=aXHk8wPrQe6VLW-C@redhat.com \
    --to=berrange@redhat.com \
    --cc=kkostiuk@redhat.com \
    --cc=michael.roth@amd.com \
    --cc=qemu-devel@nongnu.org \
    --cc=wei.wang@smartx.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.