From 2a633c461e96cb9a856292c46917653bd43959c8 Mon Sep 17 00:00:00 2001 From: Orit Wassermann Date: Wed, 16 May 2012 12:21:35 +0200 Subject: virtio: check virtio_load return code Otherwise we crash on error. Signed-off-by: Ulrich Obergfell Signed-off-by: Orit Wassermann Signed-off-by: Paolo Bonzini Signed-off-by: Anthony Liguori --- hw/virtio-net.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'hw/virtio-net.c') diff --git a/hw/virtio-net.c b/hw/virtio-net.c index bc5e3a83d1..3f190d417e 100644 --- a/hw/virtio-net.c +++ b/hw/virtio-net.c @@ -891,11 +891,15 @@ static int virtio_net_load(QEMUFile *f, void *opaque, int version_id) { VirtIONet *n = opaque; int i; + int ret; if (version_id < 2 || version_id > VIRTIO_NET_VM_VERSION) return -EINVAL; - virtio_load(&n->vdev, f); + ret = virtio_load(&n->vdev, f); + if (ret) { + return ret; + } qemu_get_buffer(f, n->mac, ETH_ALEN); n->tx_waiting = qemu_get_be32(f); -- cgit v1.2.3