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>
This commit is contained in:
Jason Wang 2013-11-06 16:58:08 +08:00 committed by Anthony Liguori
parent c2d3066776
commit fe2dafa02d
1 changed files with 1 additions and 1 deletions

View 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);
}
}