]> git.proxmox.com Git - qemu.git/commitdiff
virtio-net: properly check the vhost status during status set
authorJason Wang <jasowang@redhat.com>
Fri, 26 Apr 2013 10:27:40 +0000 (18:27 +0800)
committerAnthony Liguori <aliguori@us.ibm.com>
Tue, 7 May 2013 11:43:09 +0000 (06:43 -0500)
Commit 32993698 (vhost: disable on tap link down) tries to disable the vhost
also when the peer's link is down. But the check was not done properly, the
vhost were only started when:

1) peer's link is not down
2) virtio-net has already been started.

Since == have a higher precedence than &&, place a brace to make sure both the
conditions were met then does the check. This fixes the crash when doing a savem
after set the link off which let qemu crash and complains:

virtio_net_save: Assertion `!n->vhost_started' failed.

Cc: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jason Wang <jasowang@redhat.com>
Message-id: 1366972060-21606-1-git-send-email-jasowang@redhat.com
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
hw/net/virtio-net.c

index 908e7b809ea5f820dac8f3c38ab9f950379dd6a9..9f18d6ab091f2e297e822fa8f00a79c8ef87a616 100644 (file)
@@ -114,8 +114,8 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status)
         return;
     }
 
-    if (!!n->vhost_started == virtio_net_started(n, status) &&
-                              !nc->peer->link_down) {
+    if (!!n->vhost_started ==
+        (virtio_net_started(n, status) && !nc->peer->link_down)) {
         return;
     }
     if (!n->vhost_started) {