Commit 6b9b8758 authored by Jason Wang's avatar Jason Wang Committed by Michael S. Tsirkin
Browse files

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: default avatarJason Wang <jasowang@redhat.com>
Reviewed-by: default avatarMichael S. Tsirkin <mst@redhat.com>
Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
parent 04c7d8b8
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);
        }
    }