summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--hw/virtio-serial-bus.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index 3ea95b8b52..ce4556fc48 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -852,6 +852,12 @@ static void remove_port(VirtIOSerial *vser, uint32_t port_id)
     vser->ports_map[i] &= ~(1U << (port_id % 32));
 
     port = find_port_by_id(vser, port_id);
+    /*
+     * This function is only called from qdev's unplug callback; if we
+     * get a NULL port here, we're in trouble.
+     */
+    assert(port);
+
     /* Flush out any unconsumed buffers first */
     discard_vq_data(port->ovq, &port->vser->vdev);