]> git.proxmox.com Git - qemu.git/commit - blockdev.c
blockdev: Fix drive_del not to crash when drive is not in use
authorMarkus Armbruster <armbru@redhat.com>
Mon, 17 Jan 2011 18:31:29 +0000 (19:31 +0100)
committerKevin Wolf <kwolf@redhat.com>
Mon, 24 Jan 2011 15:49:50 +0000 (16:49 +0100)
commit850ec1133bf0f78ff19402cfd5d77eea376599a9
tree6073dddbe1725118e8f92364de7b3d632bd2eb0e
parent807105a775323be9b45ef1e965c5aad85a5ec281
blockdev: Fix drive_del not to crash when drive is not in use

Watch this:

    (qemu) drive_add 0 if=none,file=tmp.img
    OK
    (qemu) info block
    none0: type=hd removable=0 file=tmp.img ro=0 drv=raw encrypted=0
    (qemu) drive_del none0
    Segmentation fault (core dumped)

do_drive_del()'s code to clean up the pointer from a qdev using the
drive back to the drive needs to check whether such a device exists.

Signed-off-by: Markus Armbruster <armbru@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
blockdev.c