summaryrefslogtreecommitdiff
path: root/hw/virtio-serial-bus.c
diff options
context:
space:
mode:
authorAmit Shah <amit.shah@redhat.com>2010-04-27 18:03:57 +0530
committerAnthony Liguori <aliguori@us.ibm.com>2010-04-28 08:58:21 -0500
commit16af2e3c35990cb7aceb37ffe5827a28fd4614d0 (patch)
tree82a894e53f61370efd25f4356160c95ff5217ee4 /hw/virtio-serial-bus.c
parent295587f747c7747e37208540a7a7f4d13a6ba4de (diff)
downloadqemu-16af2e3c35990cb7aceb37ffe5827a28fd4614d0.tar.gz
virtio-serial: save/load: Ensure we have hot-plugged ports instantiated
If some ports that were hot-plugged on the source are not available on the destination, fail migration instead of trying to deref a NULL pointer. Signed-off-by: Amit Shah <amit.shah@redhat.com> Reported-by: Juan Quintela <quintela@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Diffstat (limited to 'hw/virtio-serial-bus.c')
-rw-r--r--hw/virtio-serial-bus.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c
index d31e62d055..5316ef626e 100644
--- a/hw/virtio-serial-bus.c
+++ b/hw/virtio-serial-bus.c
@@ -451,6 +451,13 @@ static int virtio_serial_load(QEMUFile *f, void *opaque, int version_id)
id = qemu_get_be32(f);
port = find_port_by_id(s, id);
+ if (!port) {
+ /*
+ * The requested port was hot-plugged on the source but we
+ * don't have it
+ */
+ return -EINVAL;
+ }
port->guest_connected = qemu_get_byte(f);
}