From: Markus Armbruster <armbru@redhat.com>
To: "Николай Зорин" <zorin@swemel.ru>
Cc: qemu-devel@nongnu.org, jasowang@redhat.com, mst@redhat.com
Subject: Re: [PATCH] util/error, hw/net/virtio-net: fix NULL pointer dereference in error_vprepend
Date: Wed, 16 Sep 2026 14:48:43 +0200 [thread overview]
Message-ID: <87h5jp8iqc.fsf@pond.sub.org> (raw)
In-Reply-To: <500d4850-f7d7-45fb-91e5-74d32d35fde2@swemel.ru> ("Николай Зорин"'s message of "Tue, 15 Sep 2026 19:24:39 +0300")
First, please read docs/devel/code-provenance.rst section "Use of
AI-generated content".
I'm not looking at the patches, only the commit message.
Николай Зорин <zorin@swemel.ru> writes:
> SWSA#b0709cee-9722-4603-a30c-dc857dc87961
>
> The `error_vprepend()` function modifies the error message inside an
> existing Error object. However, it only validated if the `errp` pointer
> itself was non-NULL, missing a check for whether the underlying Error
> object `*errp` is `NULL`.
This is nonsense. error_vprepend() and error_prepend() modify an error.
They must not be called when there is none. The check isn't missing.
Adding it makes the functions "work" papers over bugs.
> Calling `error_reportf_err(local_error, ...)` when `local_error` is `NULL`
> invokes `error_vprepend(&local_error, ...)`, which subsequently crashes
> via a `NULL` pointer dereference during `(*errp)->msg` access.
>
> Fix `util/error.c` by adding a defensive `!*errp` check inside
> `error_vprepend()`.
>
> Additionally, fix the invalid error reporting patterns in
> `hw/net/virtio-net.c`:
> - In `vhost_user_net_save_state()` and `vhost_user_net_load_state()`, when
> `vhdev == NULL`, calling `error_reportf_err()` with an unallocated/NULL
> `local_error` is incorrect and unsafe. Replace it with a straightforward
> `error_report()` call.
Both uses of error_reportf_err() are indeed wrong.
> - Fix a cosmetic double-space typo in "Error loading back-end state".
Worth cleaning up.
> Signed-off-by: Nikolay N Zorin <zorin@swemel.ru>
next prev parent reply other threads:[~2026-09-16 12:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-15 16:24 [PATCH] util/error, hw/net/virtio-net: fix NULL pointer dereference in error_vprepend Николай Зорин
2026-09-15 16:47 ` Michael S. Tsirkin
2026-09-16 12:48 ` Markus Armbruster [this message]
2026-09-16 13:48 ` Николай Зорин
2026-09-16 15:21 ` Michael S. Tsirkin
2026-09-17 9:55 ` Markus Armbruster
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=87h5jp8iqc.fsf@pond.sub.org \
--to=armbru@redhat.com \
--cc=jasowang@redhat.com \
--cc=mst@redhat.com \
--cc=qemu-devel@nongnu.org \
--cc=zorin@swemel.ru \
/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.