diff options
author | Alberto Garcia <berto@igalia.com> | 2015-04-17 14:52:43 +0300 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2015-04-28 15:36:09 +0200 |
commit | d5a8ee60a0fbc20a2c2d02f3bda1bb1bd365f1ee (patch) | |
tree | 7755e310e852704dbb2022a426d94e23bae02d4b /block.c | |
parent | 9419874f709469de16c1bced7731bfecb07fe1cf (diff) | |
download | qemu-d5a8ee60a0fbc20a2c2d02f3bda1bb1bd365f1ee.tar.gz qemu-d5a8ee60a0fbc20a2c2d02f3bda1bb1bd365f1ee.tar.bz2 qemu-d5a8ee60a0fbc20a2c2d02f3bda1bb1bd365f1ee.zip |
qmp: fill in the image field in BlockDeviceInfo
The image field in BlockDeviceInfo is supposed to contain an ImageInfo
object. However that is being filled in by bdrv_query_info(), not by
bdrv_block_device_info(), which is where BlockDeviceInfo is actually
created.
Anyone calling bdrv_block_device_info() directly will get a null image
field. As a consequence of this, the HMP command 'info block -n -v'
crashes QEMU.
This patch moves the code that fills in that field from
bdrv_query_info() to bdrv_block_device_info().
Signed-off-by: Alberto Garcia <berto@igalia.com>
Message-id: 1429271563-3765-1-git-send-email-berto@igalia.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Diffstat (limited to 'block.c')
-rw-r--r-- | block.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -3897,15 +3897,20 @@ BlockDriverState *bdrv_find_node(const char *node_name) } /* Put this QMP function here so it can access the static graph_bdrv_states. */ -BlockDeviceInfoList *bdrv_named_nodes_list(void) +BlockDeviceInfoList *bdrv_named_nodes_list(Error **errp) { BlockDeviceInfoList *list, *entry; BlockDriverState *bs; list = NULL; QTAILQ_FOREACH(bs, &graph_bdrv_states, node_list) { + BlockDeviceInfo *info = bdrv_block_device_info(bs, errp); + if (!info) { + qapi_free_BlockDeviceInfoList(list); + return NULL; + } entry = g_malloc0(sizeof(*entry)); - entry->value = bdrv_block_device_info(bs); + entry->value = info; entry->next = list; list = entry; } |