1 | The following changes since commit 64175afc695c0672876fbbfc31b299c86d562cb4: | 1 | The following changes since commit 0b5e750bea635b167eb03d86c3d9a09bbd43bc06: |
---|---|---|---|
2 | 2 | ||
3 | arm_gicv3: Fix ICC_BPR1 reset value when EL3 not implemented (2017-06-07 17:21:44 +0100) | 3 | Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging (2019-02-12 10:53:37 +0000) |
4 | 4 | ||
5 | are available in the git repository at: | 5 | are available in the Git repository at: |
6 | 6 | ||
7 | git://github.com/codyprime/qemu-kvm-jtc.git tags/block-pull-request | 7 | git://github.com/stefanha/qemu.git tags/block-pull-request |
8 | 8 | ||
9 | for you to fetch changes up to 56faeb9bb6872b3f926b3b3e0452a70beea10af2: | 9 | for you to fetch changes up to 42824b4d16da56a50ff4027f6cd22378e0e2666e: |
10 | 10 | ||
11 | block/gluster.c: Handle qdict_array_entries() failure (2017-06-09 08:41:29 -0400) | 11 | virtio-blk: set correct config size for the host driver (2019-02-13 16:18:17 +0800) |
12 | 12 | ||
13 | ---------------------------------------------------------------- | 13 | ---------------------------------------------------------------- |
14 | Gluster patch | 14 | Pull request |
15 | |||
16 | Fix a virtio-blk migration regression. | ||
17 | |||
15 | ---------------------------------------------------------------- | 18 | ---------------------------------------------------------------- |
16 | 19 | ||
17 | Peter Maydell (1): | 20 | Changpeng Liu (1): |
18 | block/gluster.c: Handle qdict_array_entries() failure | 21 | virtio-blk: set correct config size for the host driver |
19 | 22 | ||
20 | block/gluster.c | 3 +-- | 23 | hw/block/virtio-blk.c | 13 +++++++++---- |
21 | 1 file changed, 1 insertion(+), 2 deletions(-) | 24 | 1 file changed, 9 insertions(+), 4 deletions(-) |
22 | 25 | ||
23 | -- | 26 | -- |
24 | 2.9.3 | 27 | 2.20.1 |
25 | 28 | ||
26 | 29 | diff view generated by jsdifflib |
1 | From: Peter Maydell <peter.maydell@linaro.org> | 1 | From: Changpeng Liu <changpeng.liu@intel.com> |
---|---|---|---|
2 | 2 | ||
3 | In qemu_gluster_parse_json(), the call to qdict_array_entries() | 3 | Commit caa1ee43 "vhost-user-blk: add discard/write zeroes features |
4 | could return a negative error code, which we were ignoring | 4 | support" added fields to struct virtio_blk_config. This changes |
5 | because we assigned the result to an unsigned variable. | 5 | the size of the config space and breaks migration from QEMU 3.1 |
6 | Fix this by using the 'int' type instead, which matches the | 6 | and older: |
7 | return type of qdict_array_entries() and also the type | ||
8 | we use for the loop enumeration variable 'i'. | ||
9 | 7 | ||
10 | (Spotted by Coverity, CID 1360960.) | 8 | qemu-system-ppc64: get_pci_config_device: Bad config data: i=0x10 read: 41 device: 1 cmask: ff wmask: 80 w1cmask:0 |
9 | qemu-system-ppc64: Failed to load PCIDevice:config | ||
10 | qemu-system-ppc64: Failed to load virtio-blk:virtio | ||
11 | qemu-system-ppc64: error while loading state for instance 0x0 of device 'pci@800000020000000:01.0/virtio-blk' | ||
12 | qemu-system-ppc64: load of migration failed: Invalid argument | ||
11 | 13 | ||
12 | Signed-off-by: Peter Maydell <peter.maydell@linaro.org> | 14 | Since virtio-blk doesn't support the "discard" and "write zeroes" |
13 | Reviewed-by: Eric Blake <eblake@redhat.com> | 15 | features, it shouldn't even expose the associated fields in the |
14 | Reviewed-by: Jeff Cody <jcody@redhat.com> | 16 | config space actually. Just include all fields up to num_queues to |
15 | Message-id: 1496682098-1540-1-git-send-email-peter.maydell@linaro.org | 17 | match QEMU 3.1 and older. |
16 | Signed-off-by: Jeff Cody <jcody@redhat.com> | 18 | |
19 | Signed-off-by: Changpeng Liu <changpeng.liu@intel.com> | ||
20 | Reviewed-by: Michael S. Tsirkin <mst@redhat.com> | ||
21 | Message-id: 1550022537-27565-1-git-send-email-changpeng.liu@intel.com | ||
22 | Message-Id: <1550022537-27565-1-git-send-email-changpeng.liu@intel.com> | ||
23 | Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> | ||
17 | --- | 24 | --- |
18 | block/gluster.c | 3 +-- | 25 | hw/block/virtio-blk.c | 13 +++++++++---- |
19 | 1 file changed, 1 insertion(+), 2 deletions(-) | 26 | 1 file changed, 9 insertions(+), 4 deletions(-) |
20 | 27 | ||
21 | diff --git a/block/gluster.c b/block/gluster.c | 28 | diff --git a/hw/block/virtio-blk.c b/hw/block/virtio-blk.c |
22 | index XXXXXXX..XXXXXXX 100644 | 29 | index XXXXXXX..XXXXXXX 100644 |
23 | --- a/block/gluster.c | 30 | --- a/hw/block/virtio-blk.c |
24 | +++ b/block/gluster.c | 31 | +++ b/hw/block/virtio-blk.c |
25 | @@ -XXX,XX +XXX,XX @@ static int qemu_gluster_parse_json(BlockdevOptionsGluster *gconf, | 32 | @@ -XXX,XX +XXX,XX @@ |
26 | Error *local_err = NULL; | 33 | #include "hw/virtio/virtio-bus.h" |
27 | char *str = NULL; | 34 | #include "hw/virtio/virtio-access.h" |
28 | const char *ptr; | 35 | |
29 | - size_t num_servers; | 36 | +/* We don't support discard yet, hide associated config fields. */ |
30 | - int i, type; | 37 | +#define VIRTIO_BLK_CFG_SIZE offsetof(struct virtio_blk_config, \ |
31 | + int i, type, num_servers; | 38 | + max_discard_sectors) |
32 | 39 | + | |
33 | /* create opts info from runtime_json_opts list */ | 40 | static void virtio_blk_init_request(VirtIOBlock *s, VirtQueue *vq, |
34 | opts = qemu_opts_create(&runtime_json_opts, NULL, 0, &error_abort); | 41 | VirtIOBlockReq *req) |
42 | { | ||
43 | @@ -XXX,XX +XXX,XX @@ static void virtio_blk_update_config(VirtIODevice *vdev, uint8_t *config) | ||
44 | blkcfg.alignment_offset = 0; | ||
45 | blkcfg.wce = blk_enable_write_cache(s->blk); | ||
46 | virtio_stw_p(vdev, &blkcfg.num_queues, s->conf.num_queues); | ||
47 | - memcpy(config, &blkcfg, sizeof(struct virtio_blk_config)); | ||
48 | + memcpy(config, &blkcfg, VIRTIO_BLK_CFG_SIZE); | ||
49 | + QEMU_BUILD_BUG_ON(VIRTIO_BLK_CFG_SIZE > sizeof(blkcfg)); | ||
50 | } | ||
51 | |||
52 | static void virtio_blk_set_config(VirtIODevice *vdev, const uint8_t *config) | ||
53 | @@ -XXX,XX +XXX,XX @@ static void virtio_blk_set_config(VirtIODevice *vdev, const uint8_t *config) | ||
54 | VirtIOBlock *s = VIRTIO_BLK(vdev); | ||
55 | struct virtio_blk_config blkcfg; | ||
56 | |||
57 | - memcpy(&blkcfg, config, sizeof(blkcfg)); | ||
58 | + memcpy(&blkcfg, config, VIRTIO_BLK_CFG_SIZE); | ||
59 | + QEMU_BUILD_BUG_ON(VIRTIO_BLK_CFG_SIZE > sizeof(blkcfg)); | ||
60 | |||
61 | aio_context_acquire(blk_get_aio_context(s->blk)); | ||
62 | blk_set_enable_write_cache(s->blk, blkcfg.wce != 0); | ||
63 | @@ -XXX,XX +XXX,XX @@ static void virtio_blk_device_realize(DeviceState *dev, Error **errp) | ||
64 | return; | ||
65 | } | ||
66 | |||
67 | - virtio_init(vdev, "virtio-blk", VIRTIO_ID_BLOCK, | ||
68 | - sizeof(struct virtio_blk_config)); | ||
69 | + virtio_init(vdev, "virtio-blk", VIRTIO_ID_BLOCK, VIRTIO_BLK_CFG_SIZE); | ||
70 | |||
71 | s->blk = conf->conf.blk; | ||
72 | s->rq = NULL; | ||
35 | -- | 73 | -- |
36 | 2.9.3 | 74 | 2.20.1 |
37 | 75 | ||
38 | 76 | diff view generated by jsdifflib |