public inbox for kvm@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Check device status in tx timer
@ 2008-03-04 15:33 Dor Laor
       [not found] ` <47CD6DCF.7030008@us.ibm.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Dor Laor @ 2008-03-04 15:33 UTC (permalink / raw)
  To: kvm-devel, Anthony Liguori

repository: /home/dor/src/merge/kvm
branch: trunk
commit acdb6d2aa7332179eead306ead17494ae23edbd6
Author: Dor Laor <dor.laor@qumranet.com>
Date:   Tue Mar 4 08:16:06 2008 -0500

    Check device status in tx timer.
    
    The device can be down when the timer pops.
    If it is down it will cause segfault.
    It might happen on migration but also on regular operation
    when the device sends packets and quickly goes down before
    the host timer pops.
    
    Signed-off-by: Dor Laor <dor.laor@qumranet.com>

diff --git a/qemu/hw/virtio-net.c b/qemu/hw/virtio-net.c
index 612cf6b..a05eafb 100644
--- a/qemu/hw/virtio-net.c
+++ b/qemu/hw/virtio-net.c
@@ -280,6 +280,10 @@ static void virtio_net_tx_timer(void *opaque)
 {
     VirtIONet *n = opaque;
 
+    /* Just in case the driver is not ready on more */
+    if (!(n->vdev.status & VIRTIO_CONFIG_S_DRIVER_OK))
+        return;
+
     n->tx_vq->vring.used->flags &= ~VRING_USED_F_NO_NOTIFY;
     n->tx_timer_active = 0;
     virtio_net_flush_tx(n, n->tx_vq);


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

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2008-03-04 22:39 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-03-04 15:33 [PATCH] Check device status in tx timer Dor Laor
     [not found] ` <47CD6DCF.7030008@us.ibm.com>
2008-03-04 22:39   ` Dor Laor

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