All of lore.kernel.org
 help / color / mirror / Atom feed
From: Markus Armbruster <armbru@pond.sub.org>
To: "Philippe Mathieu-Daudé" <philmd@oss.qualcomm.com>
Cc: qemu-devel@nongnu.org,  jasowangio@gmail.com,  mst@redhat.com,
	 Nikolay N Zorin <zorin@swemel.ru>
Subject: Re: [PATCH 1/1] virtio-net: Fix crash in reporting of virtio_net_get_vhost() failure
Date: Fri, 27 Nov 2026 18:30:58 +0100	[thread overview]
Message-ID: <87cxrqqizx.fsf@pond.sub.org> (raw)
In-Reply-To: <8a0fb57b-3d87-4fff-a30a-b3c50eb0bae2@oss.qualcomm.com> ("Philippe Mathieu-Daudé"'s message of "Fri, 27 Nov 2026 17:11:28 +0100")

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;
     }


      reply	other threads:[~2026-11-27 17:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 message]

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=87cxrqqizx.fsf@pond.sub.org \
    --to=armbru@pond.sub.org \
    --cc=jasowangio@gmail.com \
    --cc=mst@redhat.com \
    --cc=philmd@oss.qualcomm.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.