All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@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 09:57:01 +0100	[thread overview]
Message-ID: <87cy32gh42.fsf@pond.sub.org> (raw)
In-Reply-To: <20260122040430.51001-1-wei.wang@smartx.com> (Wei Wang's message of "Thu, 22 Jan 2026 12:04:30 +0800")

Wei Wang <wei.wang@smartx.com> writes:

> 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");
> +        }
>          goto done;
>      }

Can guest_file_handle_add() fail without setting an error?

If yes, that's the bug that needs fixing.

If no, the error_setg() here is wrong and needs to be deleted.



  parent reply	other threads:[~2026-01-22  8:57 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é
2026-01-22  8:57 ` Markus Armbruster [this message]
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=87cy32gh42.fsf@pond.sub.org \
    --to=armbru@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.