aboutsummaryrefslogtreecommitdiff
path: root/hw/net/virtio-net.c
diff options
context:
space:
mode:
authorJason Wang <jasowang@redhat.com>2013-11-06 16:58:08 +0800
committerAnthony Liguori <aliguori@amazon.com>2013-11-06 21:46:13 -0800
commitfe2dafa02de4f80ab36f6e0f4ddfcd6418c03c49 (patch)
tree90a91892c128a2e77293c710e5ff20ee8a4b3787 /hw/net/virtio-net.c
parentc2d30667760e3d7b81290d801e567d4f758825ca (diff)
virtio-net: only delete bh that existed
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> Message-id: 1383728288-28469-1-git-send-email-jasowang@redhat.com Signed-off-by: Anthony Liguori <aliguori@amazon.com>
Diffstat (limited to 'hw/net/virtio-net.c')
-rw-r--r--hw/net/virtio-net.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
index 22dbd053d4..ae51d96a7a 100644
--- a/hw/net/virtio-net.c
+++ b/hw/net/virtio-net.c
@@ -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);
}
}