public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [Virtio-for-kvm] [PATCH 5/7] userspace virtio
@ 2007-12-21 14:44 Dor Laor
  0 siblings, 0 replies; only message in thread
From: Dor Laor @ 2007-12-21 14:44 UTC (permalink / raw)
  To: kvm-devel, virtualization, Anthony Liguori, Rusty Russell

 From 35a03164c1b4d138e55898853212bded14cf4ec7 Mon Sep 17 00:00:00 2001
From: Dor Laor <dor.laor-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
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-atKUWr5tajBWk0Htik3J/w@public.gmane.org>
---
 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


-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-12-21 14:44 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-12-21 14:44 [Virtio-for-kvm] [PATCH 5/7] userspace virtio Dor Laor

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox