]> git.proxmox.com Git - pve-qemu-kvm.git/blame - debian/patches/0005-virtio-rng-ask-for-more-data-if-queue-is-not-fully-d.patch
Fix CVE-2016-2841, CVE-2016-2857, CVE-2016-2858
[pve-qemu-kvm.git] / debian / patches / 0005-virtio-rng-ask-for-more-data-if-queue-is-not-fully-d.patch
CommitLineData
3f5d3e7d
WB
1From b5f29c3cdd14243de19d974320f49fb3bdd37a6d Mon Sep 17 00:00:00 2001
2From: Ladi Prosek <lprosek@redhat.com>
3Date: Thu, 3 Mar 2016 10:48:34 +0100
4Subject: [PATCH 5/5] virtio-rng: ask for more data if queue is not fully
5 drained
6
7This commit effectively reverts:
8
9 commit 4621c1768ef5d12171cca2aa1473595ecb9f1c9e
10 Author: Amit Shah <amit.shah@redhat.com>
11 Date: Wed Nov 21 11:21:19 2012 +0530
12
13 virtio-rng: remove extra request for entropy
14
15but instead of calling virtio_rng_process unconditionally, it
16first checks to see if the queue is empty as a little bit of
17optimization.
18
19Signed-off-by: Ladi Prosek <lprosek@redhat.com>
20Reviewed-by: Amit Shah <amit.shah@redhat.com>
21Message-Id: <1456998514-19271-1-git-send-email-lprosek@redhat.com>
22Signed-off-by: Amit Shah <amit.shah@redhat.com>
23---
24 hw/virtio/virtio-rng.c | 7 +++++++
25 1 file changed, 7 insertions(+)
26
27diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c
28index 97d1541..3124461 100644
29--- a/hw/virtio/virtio-rng.c
30+++ b/hw/virtio/virtio-rng.c
31@@ -66,6 +66,13 @@ static void chr_read(void *opaque, const void *buf, size_t size)
32 trace_virtio_rng_pushed(vrng, len);
33 }
34 virtio_notify(vdev, vrng->vq);
35+
36+ if (!virtio_queue_empty(vrng->vq)) {
37+ /* If we didn't drain the queue, call virtio_rng_process
38+ * to take care of asking for more data as appropriate.
39+ */
40+ virtio_rng_process(vrng);
41+ }
42 }
43
44 static void virtio_rng_process(VirtIORNG *vrng)
45--
462.1.4
47