From fb6e2b0d832d1b7de857c3c7499c90f8ac0aa7d8 Mon Sep 17 00:00:00 2001 From: Amos Kong Date: Mon, 7 Jul 2014 16:49:33 +0200 Subject: [PATCH 09/44] virtio-rng: check return value of virtio_load() (RHEL-6 only) RH-Author: Amos Kong Message-id: <1404751773-5398-1-git-send-email-akong@redhat.com> Patchwork-id: 59497 O-Subject: [RHEL-6.6 qemu-kvm PATCH] virtio-rng: check return value of virtio_load() (RHEL-6 only) Bugzilla: 1102668 RH-Acked-by: Dr. David Alan Gilbert (git) RH-Acked-by: Laszlo Ersek RH-Acked-by: Amit Shah Bugzilla: 1102668 Brew: http://brewweb.devel.redhat.com/brew/taskinfo?taskID=7673532 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-rng.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) Signed-off-by: Miroslav Rezanina --- hw/virtio-rng.c | 7 ++++++- 1 files changed, 6 insertions(+), 1 deletions(-) diff --git a/hw/virtio-rng.c b/hw/virtio-rng.c index da539e2..afa8430 100644 --- a/hw/virtio-rng.c +++ b/hw/virtio-rng.c @@ -123,11 +123,16 @@ static void virtio_rng_save(QEMUFile *f, void *opaque) static int virtio_rng_load(QEMUFile *f, void *opaque, int version_id) { VirtIORNG *vrng = opaque; + int ret; if (version_id != 1) { return -EINVAL; } - virtio_load(&vrng->vdev, f); + + ret = virtio_load(&vrng->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