]> Git Repo - qemu.git/commitdiff
virtio-net: handle virtio_net_handle_ctrl() error
authorGreg Kurz <[email protected]>
Fri, 30 Sep 2016 15:13:16 +0000 (17:13 +0200)
committerMichael S. Tsirkin <[email protected]>
Sun, 9 Oct 2016 22:16:59 +0000 (01:16 +0300)
This error is caused by a buggy guest: let's switch the device to the
broken state instead of terminating QEMU. Also we detach the element
from the virtqueue and free it.

Signed-off-by: Greg Kurz <[email protected]>
Reviewed-by: Stefan Hajnoczi <[email protected]>
Reviewed-by: Michael S. Tsirkin <[email protected]>
Signed-off-by: Michael S. Tsirkin <[email protected]>
hw/net/virtio-net.c

index 6b8ae2c1fafd4d94ec88ed428ceb22d0daf8fbcb..a1584e1e67e68a93f3c8e1cbe980e333e6b92c36 100644 (file)
@@ -880,6 +880,7 @@ static int virtio_net_handle_mq(VirtIONet *n, uint8_t cmd,
 
     return VIRTIO_NET_OK;
 }
+
 static void virtio_net_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
 {
     VirtIONet *n = VIRTIO_NET(vdev);
@@ -897,8 +898,10 @@ static void virtio_net_handle_ctrl(VirtIODevice *vdev, VirtQueue *vq)
         }
         if (iov_size(elem->in_sg, elem->in_num) < sizeof(status) ||
             iov_size(elem->out_sg, elem->out_num) < sizeof(ctrl)) {
-            error_report("virtio-net ctrl missing headers");
-            exit(1);
+            virtio_error(vdev, "virtio-net ctrl missing headers");
+            virtqueue_detach_element(vq, elem, 0);
+            g_free(elem);
+            break;
         }
 
         iov_cnt = elem->out_num;
This page took 0.030844 seconds and 4 git commands to generate.