From: Jason Wang <jasow...@redhat.com> 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-sta...@nongnu.org Signed-off-by: Jason Wang <jasow...@redhat.com> Reviewed-by: Michael S. Tsirkin <m...@redhat.com> Message-id: 1383728288-28469-1-git-send-email-jasow...@redhat.com Signed-off-by: Anthony Liguori <aligu...@amazon.com> (cherry picked from commit fe2dafa02de4f80ab36f6e0f4ddfcd6418c03c49) Conflicts: hw/net/virtio-net.c *modified to reflect timer function names for 1.6 Signed-off-by: Michael Roth <mdr...@linux.vnet.ibm.com> --- hw/net/virtio-net.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c index aa1880c..bb757b3 100644 --- a/hw/net/virtio-net.c +++ b/hw/net/virtio-net.c @@ -1600,7 +1600,7 @@ static int virtio_net_device_exit(DeviceState *qdev) if (q->tx_timer) { qemu_del_timer(q->tx_timer); qemu_free_timer(q->tx_timer); - } else { + } else if (q->tx_bh) { qemu_bh_delete(q->tx_bh); } } -- 1.7.9.5