From 590c54266333cf9b147144d80999086dc877aba3 Mon Sep 17 00:00:00 2001 From: Amos Kong Date: Mon, 4 Aug 2014 03:16:39 +0200 Subject: [PATCH 3/4] virtio-rng: check return value of virtio_load() Message-id: <1407122199-6365-1-git-send-email-akong@redhat.com> Patchwork-id: 60412 O-Subject: [RHEL-7.1 qemu-kvm PATCH] virtio-rng: check return value of virtio_load() Bugzilla: 1116941 RH-Acked-by: Laszlo Ersek RH-Acked-by: Fam Zheng RH-Acked-by: Amit Shah Bugzilla: 1116941 Brew: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7780748 Upstream: it's fixed by commit 3902d49e, we don't need to backport whole patch. virtio_load() might fail, we should check the return value. Signed-off-by: Amos Kong --- hw/virtio/virtio-rng.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) Signed-off-by: Miroslav Rezanina --- hw/virtio/virtio-rng.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c index 6895146..83d4a55 100644 --- a/hw/virtio/virtio-rng.c +++ b/hw/virtio/virtio-rng.c @@ -108,11 +108,16 @@ static int virtio_rng_load(QEMUFile *f, void *opaque, int version_id) { VirtIORNG *vrng = opaque; VirtIODevice *vdev = VIRTIO_DEVICE(vrng); + int ret; if (version_id != 1) { return -EINVAL; } - virtio_load(vdev, f); + + ret = virtio_load(vdev, f); + if (ret) { + return ret; + } /* We may have an element ready but couldn't process it due to a quota * limit. Make sure to try again after live migration when the quota may -- 1.7.1