aboutsummaryrefslogtreecommitdiff
path: root/bt-host.c
diff options
context:
space:
mode:
authorKevin Wolf <kwolf@redhat.com>2016-06-23 09:30:01 +0200
committerKevin Wolf <kwolf@redhat.com>2016-07-05 16:46:26 +0200
commita9d52a75634ac9aa7d101bf7f63e10bf6655a865 (patch)
treea13456344c8aeea7e2d9eb2ea82c307f9e786185 /bt-host.c
parent1c42f149ddc1ff7dd897ef2696ad662955a5ab2b (diff)
downloadqemu-a9d52a75634ac9aa7d101bf7f63e10bf6655a865.zip
qemu-a9d52a75634ac9aa7d101bf7f63e10bf6655a865.tar.gz
qemu-a9d52a75634ac9aa7d101bf7f63e10bf6655a865.tar.bz2
block/qdev: Fix NULL access when using BB twice
BlockBackend has only a single pointer to its guest device, so it makes sure that only a single guest device is attached to it. device-add returns an error if you try to attach a second device to a BB. In order to make the error message nicer, -device that manually connects to a if=none block device get a different message than -drive that implicitly creates a guest device. The if=... option is stored in DriveInfo. However, since blockdev-add exists, not every BlockBackend has a DriveInfo any more. Check that it exists before we dereference it. QMP reproducer resulting in a segfault: {"execute":"blockdev-add","arguments":{"options":{"id":"disk","driver":"file","filename":"/tmp/test.img"}}} {"execute":"device_add","arguments":{"driver":"virtio-blk-pci","drive":"disk"}} {"execute":"device_add","arguments":{"driver":"virtio-blk-pci","drive":"disk"}} Signed-off-by: Kevin Wolf <kwolf@redhat.com> Reviewed-by: Eric Blake <eblake@redhat.com> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'bt-host.c')
0 files changed, 0 insertions, 0 deletions