From 35a03164c1b4d138e55898853212bded14cf4ec7 Mon Sep 17 00:00:00 2001 From: Dor Laor <dor.laor@qumranet.com> Date: Mon, 17 Dec 2007 01:43:28 +0200 Subject: [PATCH] Check for device status on tx. Allow tx only if VIRTIO_CONFIG_S_DRIVER_OK. It can prevent an smp race of tx and driver unload. Signed-off-by: Dor Laor <dor.laor@qumranet.com> --- qemu/hw/virtio-net.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-) diff --git a/qemu/hw/virtio-net.c b/qemu/hw/virtio-net.c index 3320dd8..f6f1f28 100644 --- a/qemu/hw/virtio-net.c +++ b/qemu/hw/virtio-net.c @@ -140,6 +140,9 @@ static void virtio_net_handle_tx(VirtIODevice *vdev, VirtQueue *vq) VirtIONet *n = to_virtio_net(vdev); VirtQueueElement elem; + if (!(n->vdev.status & VIRTIO_CONFIG_S_DRIVER_OK)) + return; + while (virtqueue_pop(vq, &elem)) { int i; size_t len = 0; -- 1.5.3.3