* [PATCH 0/1] virtio-net: Fix crash in reporting of virtio_net_get_vhost() failure @ 2026-11-27 15:23 Markus Armbruster 2026-11-27 15:23 ` [PATCH 1/1] " Markus Armbruster 0 siblings, 1 reply; 5+ messages in thread From: Markus Armbruster @ 2026-11-27 15:23 UTC (permalink / raw) To: qemu-devel; +Cc: jasowangio, mst Some time ago, Nikolay N Zorin posted "[PATCH] util/error, hw/net/virtio-net: fix NULL pointer dereference in error_vprepend". I pointed out flaws, and expected a v2. I haven't seen one. So I'm treating it as a bug report. This is the fix for the valid part of the report. Markus Armbruster (1): virtio-net: Fix crash in reporting of virtio_net_get_vhost() failure hw/net/virtio-net.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) -- 2.55.0 ^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/1] virtio-net: Fix crash in reporting of virtio_net_get_vhost() failure 2026-11-27 15:23 [PATCH 0/1] virtio-net: Fix crash in reporting of virtio_net_get_vhost() failure Markus Armbruster @ 2026-11-27 15:23 ` Markus Armbruster 2026-11-27 15:40 ` Daniel P. Berrangé 2026-11-27 16:11 ` Philippe Mathieu-Daudé 0 siblings, 2 replies; 5+ messages in thread From: Markus Armbruster @ 2026-11-27 15:23 UTC (permalink / raw) To: qemu-devel; +Cc: jasowangio, mst, Nikolay N Zorin vhost_user_net_save_state() and vhost_user_net_load_state() pass @local_error to error_reportf_err() when virtio_net_get_vhost() failed. @local_error is null then. Use error_report() instead. While there, tidy up extra space in a nearby error message. Fixes: 60f543ad917f ("virtio-net: vhost-user: Implement internal migration") Reported-by: Nikolay N Zorin <zorin@swemel.ru> Signed-off-by: Markus Armbruster <armbru@redhat.com> --- hw/net/virtio-net.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 36edb768b17..6ebc5b1d2fc 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -3587,9 +3587,8 @@ static int vhost_user_net_save_state(QEMUFile *f, void *pv, size_t size, vhdev = virtio_net_get_vhost(vdev); if (vhdev == NULL) { - error_reportf_err(local_error, - "Error getting vhost back-end of %s device %s: ", - vdev->name, vdev->parent_obj.canonical_path); + error_report("Error getting vhost back-end of %s device %s", + vdev->name, vdev->parent_obj.canonical_path); return -1; } @@ -3615,16 +3614,15 @@ static int vhost_user_net_load_state(QEMUFile *f, void *pv, size_t size, vhdev = virtio_net_get_vhost(vdev); if (vhdev == NULL) { - error_reportf_err(local_error, - "Error getting vhost back-end of %s device %s: ", - vdev->name, vdev->parent_obj.canonical_path); + error_report("Error getting vhost back-end of %s device %s", + vdev->name, vdev->parent_obj.canonical_path); return -1; } ret = vhost_load_backend_state(vhdev, f, &local_error); if (ret < 0) { error_reportf_err(local_error, - "Error loading back-end state of %s device %s: ", + "Error loading back-end state of %s device %s: ", vdev->name, vdev->parent_obj.canonical_path); return ret; } -- 2.55.0 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] virtio-net: Fix crash in reporting of virtio_net_get_vhost() failure 2026-11-27 15:23 ` [PATCH 1/1] " Markus Armbruster @ 2026-11-27 15:40 ` Daniel P. Berrangé 2026-11-27 16:11 ` Philippe Mathieu-Daudé 1 sibling, 0 replies; 5+ messages in thread From: Daniel P. Berrangé @ 2026-11-27 15:40 UTC (permalink / raw) To: Markus Armbruster; +Cc: qemu-devel, jasowangio, mst, Nikolay N Zorin On Fri, Nov 27, 2026 at 04:23:54PM +0100, Markus Armbruster wrote: > vhost_user_net_save_state() and vhost_user_net_load_state() pass > @local_error to error_reportf_err() when virtio_net_get_vhost() > failed. @local_error is null then. Use error_report() instead. > > While there, tidy up extra space in a nearby error message. > > Fixes: 60f543ad917f ("virtio-net: vhost-user: Implement internal migration") > Reported-by: Nikolay N Zorin <zorin@swemel.ru> > Signed-off-by: Markus Armbruster <armbru@redhat.com> > --- > hw/net/virtio-net.c | 12 +++++------- > 1 file changed, 5 insertions(+), 7 deletions(-) Reviewed-by: Daniel P. Berrangé <berrange@redhat.com> With regards, Daniel -- |: https://berrange.com ~~ https://hachyderm.io/@berrange :| |: https://libvirt.org ~~ https://entangle-photo.org :| |: https://pixelfed.art/berrange ~~ https://fstop138.berrange.com :| ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] virtio-net: Fix crash in reporting of virtio_net_get_vhost() failure 2026-11-27 15:23 ` [PATCH 1/1] " Markus Armbruster 2026-11-27 15:40 ` Daniel P. Berrangé @ 2026-11-27 16:11 ` Philippe Mathieu-Daudé 2026-11-27 17:30 ` Markus Armbruster 1 sibling, 1 reply; 5+ messages in thread From: Philippe Mathieu-Daudé @ 2026-11-27 16:11 UTC (permalink / raw) To: Markus Armbruster, qemu-devel; +Cc: jasowangio, mst, Nikolay N Zorin On 27/11/26 16:23, Markus Armbruster wrote: > vhost_user_net_save_state() and vhost_user_net_load_state() pass > @local_error to error_reportf_err() when virtio_net_get_vhost() > failed. @local_error is null then. Use error_report() instead. > > While there, tidy up extra space in a nearby error message. > > Fixes: 60f543ad917f ("virtio-net: vhost-user: Implement internal migration") > Reported-by: Nikolay N Zorin <zorin@swemel.ru> > Signed-off-by: Markus Armbruster <armbru@redhat.com> > --- > hw/net/virtio-net.c | 12 +++++------- > 1 file changed, 5 insertions(+), 7 deletions(-) > > diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c > index 36edb768b17..6ebc5b1d2fc 100644 > --- a/hw/net/virtio-net.c > +++ b/hw/net/virtio-net.c > @@ -3587,9 +3587,8 @@ static int vhost_user_net_save_state(QEMUFile *f, void *pv, size_t size, > > vhdev = virtio_net_get_vhost(vdev); > if (vhdev == NULL) { > - error_reportf_err(local_error, > - "Error getting vhost back-end of %s device %s: ", > - vdev->name, vdev->parent_obj.canonical_path); > + error_report("Error getting vhost back-end of %s device %s", > + vdev->name, vdev->parent_obj.canonical_path); Pre-existing, @parent_obj is internal field, we should access it as DEVICE(vdev)->canonical_path (this is error report, not fast path, no excuse). Anyway, Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/1] virtio-net: Fix crash in reporting of virtio_net_get_vhost() failure 2026-11-27 16:11 ` Philippe Mathieu-Daudé @ 2026-11-27 17:30 ` Markus Armbruster 0 siblings, 0 replies; 5+ messages in thread From: Markus Armbruster @ 2026-11-27 17:30 UTC (permalink / raw) To: Philippe Mathieu-Daudé; +Cc: qemu-devel, jasowangio, mst, Nikolay N Zorin Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> writes: > On 27/11/26 16:23, Markus Armbruster wrote: >> vhost_user_net_save_state() and vhost_user_net_load_state() pass >> @local_error to error_reportf_err() when virtio_net_get_vhost() >> failed. @local_error is null then. Use error_report() instead. >> While there, tidy up extra space in a nearby error message. >> Fixes: 60f543ad917f ("virtio-net: vhost-user: Implement internal migration") >> Reported-by: Nikolay N Zorin <zorin@swemel.ru> >> Signed-off-by: Markus Armbruster <armbru@redhat.com> >> --- >> hw/net/virtio-net.c | 12 +++++------- >> 1 file changed, 5 insertions(+), 7 deletions(-) >> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c >> index 36edb768b17..6ebc5b1d2fc 100644 >> --- a/hw/net/virtio-net.c >> +++ b/hw/net/virtio-net.c >> @@ -3587,9 +3587,8 @@ static int vhost_user_net_save_state(QEMUFile *f, void *pv, size_t size, >> vhdev = virtio_net_get_vhost(vdev); >> if (vhdev == NULL) { >> - error_reportf_err(local_error, >> - "Error getting vhost back-end of %s device %s: ", >> - vdev->name, vdev->parent_obj.canonical_path); >> + error_report("Error getting vhost back-end of %s device %s", >> + vdev->name, vdev->parent_obj.canonical_path); > > Pre-existing, @parent_obj is internal field, we should access > it as DEVICE(vdev)->canonical_path (this is error report, not > fast path, no excuse). Something like the appended patch? I hesitate to post this for 11.2... > Anyway, > Reviewed-by: Philippe Mathieu-Daudé <philmd@oss.qualcomm.com> Thank you! diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 6ebc5b1d2fc..3984218e08a 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -3588,7 +3588,7 @@ static int vhost_user_net_save_state(QEMUFile *f, void *pv, size_t size, vhdev = virtio_net_get_vhost(vdev); if (vhdev == NULL) { error_report("Error getting vhost back-end of %s device %s", - vdev->name, vdev->parent_obj.canonical_path); + vdev->name, DEVICE(vdev)->canonical_path); return -1; } @@ -3596,7 +3596,7 @@ static int vhost_user_net_save_state(QEMUFile *f, void *pv, size_t size, if (ret < 0) { error_reportf_err(local_error, "Error saving back-end state of %s device %s: ", - vdev->name, vdev->parent_obj.canonical_path); + vdev->name, DEVICE(vdev)->canonical_path); return ret; } @@ -3615,7 +3615,7 @@ static int vhost_user_net_load_state(QEMUFile *f, void *pv, size_t size, vhdev = virtio_net_get_vhost(vdev); if (vhdev == NULL) { error_report("Error getting vhost back-end of %s device %s", - vdev->name, vdev->parent_obj.canonical_path); + vdev->name, DEVICE(vdev)->canonical_path); return -1; } @@ -3623,7 +3623,7 @@ static int vhost_user_net_load_state(QEMUFile *f, void *pv, size_t size, if (ret < 0) { error_reportf_err(local_error, "Error loading back-end state of %s device %s: ", - vdev->name, vdev->parent_obj.canonical_path); + vdev->name, DEVICE(vdev)->canonical_path); return ret; } diff --git a/hw/virtio/vhost-user-fs.c b/hw/virtio/vhost-user-fs.c index 115d7740fa5..c3c036ca0c9 100644 --- a/hw/virtio/vhost-user-fs.c +++ b/hw/virtio/vhost-user-fs.c @@ -322,7 +322,7 @@ static int vuf_save_state(QEMUFile *f, void *pv, size_t size, error_reportf_err(local_error, "Error saving back-end state of %s device %s " "(tag: \"%s\"): ", - vdev->name, vdev->parent_obj.canonical_path, + vdev->name, DEVICE(vdev)->canonical_path, fs->conf.tag ?: "<none>"); return ret; } @@ -346,7 +346,7 @@ static int vuf_load_state(QEMUFile *f, void *pv, size_t size, error_reportf_err(local_error, "Error loading back-end state of %s device %s " "(tag: \"%s\"): ", - vdev->name, vdev->parent_obj.canonical_path, + vdev->name, DEVICE(vdev)->canonical_path, fs->conf.tag ?: "<none>"); return ret; } @@ -368,7 +368,7 @@ static int vuf_check_migration_support(void *opaque) if (!vhost_supports_device_state(&fs->vhost_dev)) { error_report("Back-end of %s device %s (tag: \"%s\") does not support " "migration through qemu", - vdev->name, vdev->parent_obj.canonical_path, + vdev->name, DEVICE(vdev)->canonical_path, fs->conf.tag ?: "<none>"); return -ENOTSUP; } ^ permalink raw reply related [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-11-27 17:31 UTC | newest] Thread overview: 5+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2026-11-27 15:23 [PATCH 0/1] virtio-net: Fix crash in reporting of virtio_net_get_vhost() failure Markus Armbruster 2026-11-27 15:23 ` [PATCH 1/1] " Markus Armbruster 2026-11-27 15:40 ` Daniel P. Berrangé 2026-11-27 16:11 ` Philippe Mathieu-Daudé 2026-11-27 17:30 ` Markus Armbruster
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.