diff options
author | Kevin Wolf <kwolf@redhat.com> | 2018-03-05 15:59:35 +0100 |
---|---|---|
committer | Kevin Wolf <kwolf@redhat.com> | 2018-03-05 18:45:32 +0100 |
commit | bfe1a14c180ec44c033be12b9151252ffda69292 (patch) | |
tree | c0f703563f7578cdaf949e7d70764946ec9b1c8b /qapi | |
parent | 9d9b4b640f9e583ff4b24dc762630945f3ccc16d (diff) | |
download | qemu-bfe1a14c180ec44c033be12b9151252ffda69292.zip qemu-bfe1a14c180ec44c033be12b9151252ffda69292.tar.gz qemu-bfe1a14c180ec44c033be12b9151252ffda69292.tar.bz2 |
block: Fix NULL dereference on empty drive error
blk_error_action() sends a BLOCK_IO_ERROR QMP event which includes the
node name of its root node. If the BlockBackend represents an empty
drive, there is no root node, so we should not try to access its node
name. Make the field optional in the event and include it only when
the BlockBackend isn't empty.
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Diffstat (limited to 'qapi')
-rw-r--r-- | qapi/block-core.json | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/qapi/block-core.json b/qapi/block-core.json index 5c5921b..00475f0 100644 --- a/qapi/block-core.json +++ b/qapi/block-core.json @@ -3676,7 +3676,8 @@ # # @node-name: node name. Note that errors may be reported for the root node # that is directly attached to a guest device rather than for the -# node where the error occurred. (Since: 2.8) +# node where the error occurred. The node name is not present if +# the drive is empty. (Since: 2.8) # # @operation: I/O operation # @@ -3707,7 +3708,8 @@ # ## { 'event': 'BLOCK_IO_ERROR', - 'data': { 'device': 'str', 'node-name': 'str', 'operation': 'IoOperationType', + 'data': { 'device': 'str', '*node-name': 'str', + 'operation': 'IoOperationType', 'action': 'BlockErrorAction', '*nospace': 'bool', 'reason': 'str' } } |