]> git.proxmox.com Git - pve-qemu-kvm.git/blob - 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
1 From b5f29c3cdd14243de19d974320f49fb3bdd37a6d Mon Sep 17 00:00:00 2001
2 From: Ladi Prosek <lprosek@redhat.com>
3 Date: Thu, 3 Mar 2016 10:48:34 +0100
4 Subject: [PATCH 5/5] virtio-rng: ask for more data if queue is not fully
5 drained
6
7 This 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
15 but instead of calling virtio_rng_process unconditionally, it
16 first checks to see if the queue is empty as a little bit of
17 optimization.
18
19 Signed-off-by: Ladi Prosek <lprosek@redhat.com>
20 Reviewed-by: Amit Shah <amit.shah@redhat.com>
21 Message-Id: <1456998514-19271-1-git-send-email-lprosek@redhat.com>
22 Signed-off-by: Amit Shah <amit.shah@redhat.com>
23 ---
24 hw/virtio/virtio-rng.c | 7 +++++++
25 1 file changed, 7 insertions(+)
26
27 diff --git a/hw/virtio/virtio-rng.c b/hw/virtio/virtio-rng.c
28 index 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 --
46 2.1.4
47