]> git.proxmox.com Git - pve-qemu-kvm.git/blob - debian/patches/extra/0002-scsi-esp-fix-migration.patch
fix various CVEs
[pve-qemu-kvm.git] / debian / patches / extra / 0002-scsi-esp-fix-migration.patch
1 From 10cf6bf50d000a1b0dad1d5f2b931d1d1b1ff7f3 Mon Sep 17 00:00:00 2001
2 From: Paolo Bonzini <pbonzini@redhat.com>
3 Date: Mon, 20 Jun 2016 16:32:39 +0200
4 Subject: [PATCH 2/2] scsi: esp: fix migration
5
6 Commit 926cde5 ("scsi: esp: make cmdbuf big enough for maximum CDB size",
7 2016-06-16) changed the size of a migrated field. Split it in two
8 parts, and only migrate the second part in a new vmstate version.
9
10 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
11 ---
12 hw/scsi/esp.c | 5 +++--
13 include/migration/vmstate.h | 5 ++++-
14 2 files changed, 7 insertions(+), 3 deletions(-)
15
16 diff --git a/hw/scsi/esp.c b/hw/scsi/esp.c
17 index e533522..8cff94b 100644
18 --- a/hw/scsi/esp.c
19 +++ b/hw/scsi/esp.c
20 @@ -573,7 +573,7 @@ static bool esp_mem_accepts(void *opaque, hwaddr addr,
21
22 const VMStateDescription vmstate_esp = {
23 .name ="esp",
24 - .version_id = 3,
25 + .version_id = 4,
26 .minimum_version_id = 3,
27 .fields = (VMStateField[]) {
28 VMSTATE_BUFFER(rregs, ESPState),
29 @@ -584,7 +584,8 @@ const VMStateDescription vmstate_esp = {
30 VMSTATE_BUFFER(ti_buf, ESPState),
31 VMSTATE_UINT32(status, ESPState),
32 VMSTATE_UINT32(dma, ESPState),
33 - VMSTATE_BUFFER(cmdbuf, ESPState),
34 + VMSTATE_PARTIAL_BUFFER(cmdbuf, ESPState, 16),
35 + VMSTATE_BUFFER_START_MIDDLE_V(cmdbuf, ESPState, 16, 4),
36 VMSTATE_UINT32(cmdlen, ESPState),
37 VMSTATE_UINT32(do_cmd, ESPState),
38 VMSTATE_UINT32(dma_left, ESPState),
39 diff --git a/include/migration/vmstate.h b/include/migration/vmstate.h
40 index 84ee355..853a2bd 100644
41 --- a/include/migration/vmstate.h
42 +++ b/include/migration/vmstate.h
43 @@ -888,8 +888,11 @@ extern const VMStateInfo vmstate_info_bitmap;
44 #define VMSTATE_PARTIAL_BUFFER(_f, _s, _size) \
45 VMSTATE_STATIC_BUFFER(_f, _s, 0, NULL, 0, _size)
46
47 +#define VMSTATE_BUFFER_START_MIDDLE_V(_f, _s, _start, _v) \
48 + VMSTATE_STATIC_BUFFER(_f, _s, _v, NULL, _start, sizeof(typeof_field(_s, _f)))
49 +
50 #define VMSTATE_BUFFER_START_MIDDLE(_f, _s, _start) \
51 - VMSTATE_STATIC_BUFFER(_f, _s, 0, NULL, _start, sizeof(typeof_field(_s, _f)))
52 + VMSTATE_BUFFER_START_MIDDLE_V(_f, _s, _start, 0)
53
54 #define VMSTATE_PARTIAL_VBUFFER(_f, _s, _size) \
55 VMSTATE_VBUFFER(_f, _s, 0, NULL, 0, _size)
56 --
57 2.1.4
58