From: Jason Wang Date: Wed, 6 Nov 2013 08:58:08 +0000 (+0800) Subject: virtio-net: only delete bh that existed X-Git-Tag: v1.7.0-rc1~26^2~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6b9b8758c15f3bc2875dbd6e2d03c5362b8d6902;p=thirdparty%2Fqemu.git 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 Reviewed-by: Michael S. Tsirkin Signed-off-by: Michael S. Tsirkin --- diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index 22dbd053d49..ae51d96a7aa 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); } }