]> git.proxmox.com Git - mirror_qemu.git/commit - block.c
block: Fix direct use of protocols as driver for bdrv_open()
authorKevin Wolf <kwolf@redhat.com>
Wed, 27 Mar 2013 16:28:18 +0000 (17:28 +0100)
committerStefan Hajnoczi <stefanha@redhat.com>
Thu, 28 Mar 2013 10:58:40 +0000 (11:58 +0100)
commit5d186eb03eb37b257e29a4731ca484362d5fc4e4
treeffa427b0c9df054073f6b9fb17b016697a9339dc
parentecdd5333ab9ed3f2b848066aaaef02c027b25e36
block: Fix direct use of protocols as driver for bdrv_open()

bdrv_open_common() implements direct use of protocols by copying the
pre-opened BlockDriverStates to bs using bdrv_swap(). It did however
first set some fields in bs, which end up in file after the swap. When
bdrv_open() destroys file, it appears to be open, and because it isn't,
qemu could segfault while trying to close it.

Reorder the operations to return immediately in such cases so that file
is correctly detected as closed.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
block.c