]> git.proxmox.com Git - qemu.git/commitdiff
virtio-net: only delete bh that existed
authorJason Wang <jasowang@redhat.com>
Wed, 6 Nov 2013 08:58:08 +0000 (16:58 +0800)
committerMichael S. Tsirkin <mst@redhat.com>
Sun, 10 Nov 2013 10:08:38 +0000 (12:08 +0200)
We delete without check whether it existed during exit. This will lead NULL
pointer deference since it was created conditionally depends on guest driver
status and features. So add a check of existence before trying to delete it.

Cc: qemu-stable@nongnu.org
Signed-off-by: Jason Wang <jasowang@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
hw/net/virtio-net.c

index 22dbd053d494feac98a6f580e8809002e1bb750c..ae51d96a7aa0b1454aa3a9fc05831935fb7d73aa 100644 (file)
@@ -1601,7 +1601,7 @@ static int virtio_net_device_exit(DeviceState *qdev)
         if (q->tx_timer) {
             timer_del(q->tx_timer);
             timer_free(q->tx_timer);
-        } else {
+        } else if (q->tx_bh) {
             qemu_bh_delete(q->tx_bh);
         }
     }