Update qemu package to mitigate CVE-2015-3456
[packages/centos6/qemu.git] / 0014-pxa2xx-avoid-buffer-overrun-on-incoming-migration.patch
1 From 43b30dec4d07aa81ff5f2dc3b0a064fa589fd3af Mon Sep 17 00:00:00 2001
2 From: "Michael S. Tsirkin" <mst@redhat.com>
3 Date: Thu, 3 Apr 2014 19:51:57 +0300
4 Subject: [PATCH] pxa2xx: avoid buffer overrun on incoming migration
5
6 CVE-2013-4533
7
8 s->rx_level is read from the wire and used to determine how many bytes
9 to subsequently read into s->rx_fifo[]. If s->rx_level exceeds the
10 length of s->rx_fifo[] the buffer can be overrun with arbitrary data
11 from the wire.
12
13 Fix this by validating rx_level against the size of s->rx_fifo.
14
15 Cc: Don Koch <dkoch@verizon.com>
16 Reported-by: Michael Roth <mdroth@linux.vnet.ibm.com>
17 Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
18 Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
19 Reviewed-by: Don Koch <dkoch@verizon.com>
20 Signed-off-by: Juan Quintela <quintela@redhat.com>
21 (cherry picked from commit caa881abe0e01f9931125a0977ec33c5343e4aa7)
22 ---
23  hw/arm/pxa2xx.c | 8 ++++++--
24  1 file changed, 6 insertions(+), 2 deletions(-)
25
26 diff --git a/hw/arm/pxa2xx.c b/hw/arm/pxa2xx.c
27 index 0429148..e0cd847 100644
28 --- a/hw/arm/pxa2xx.c
29 +++ b/hw/arm/pxa2xx.c
30 @@ -732,7 +732,7 @@ static void pxa2xx_ssp_save(QEMUFile *f, void *opaque)
31  static int pxa2xx_ssp_load(QEMUFile *f, void *opaque, int version_id)
32  {
33      PXA2xxSSPState *s = (PXA2xxSSPState *) opaque;
34 -    int i;
35 +    int i, v;
36  
37      s->enable = qemu_get_be32(f);
38  
39 @@ -746,7 +746,11 @@ static int pxa2xx_ssp_load(QEMUFile *f, void *opaque, int version_id)
40      qemu_get_8s(f, &s->ssrsa);
41      qemu_get_8s(f, &s->ssacd);
42  
43 -    s->rx_level = qemu_get_byte(f);
44 +    v = qemu_get_byte(f);
45 +    if (v < 0 || v > ARRAY_SIZE(s->rx_fifo)) {
46 +        return -EINVAL;
47 +    }
48 +    s->rx_level = v;
49      s->rx_start = 0;
50      for (i = 0; i < s->rx_level; i ++)
51          s->rx_fifo[i] = qemu_get_byte(f);