xemu/block
Paolo Bonzini bae0a0cc38 vmdk: clean up open
Move vmdk_parent_open to vmdk_open.  There's another path how
vmdk_parent_open can be reached:

  vmdk_parse_extents() ->  vmdk_open_sparse() ->  vmdk_open_vmdk4() ->
  vmdk_open_desc_file().

If that can happen, however, the code is bogus.  vmdk_parent_open
reads from bs->file:

    if (bdrv_pread(bs->file, s->desc_offset, desc, DESC_SIZE) != DESC_SIZE) {

but it is always called with s->desc_offset == 0 and with the same
bs->file.  So the data that vmdk_parent_open reads comes always from the
same place, and anyway there is only one place where it can write it,
namely bs->backing_file.

So, if it cannot happen, the patched code is okay.

It is also possible that the recursive call can happen, but only once.  In
that case there would still be a bug in vmdk_open_desc_file setting
s->desc_offset = 0, but the patched code is okay.

Finally, in the case where multiple recursive calls can happen the code
would need to be rewritten anyway.  It is likely that this would anyway
involve adding several parameters to vmdk_parent_open, and calling it from
vmdk_open_vmdk4.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2011-10-21 17:34:13 +02:00
..
blkdebug.c block: drop redundant bdrv_flush implementation 2011-10-21 17:34:13 +02:00
blkverify.c block: drop redundant bdrv_flush implementation 2011-10-21 17:34:13 +02:00
bochs.c Use glib memory allocation and free functions 2011-08-20 23:01:08 -05:00
cloop.c Use glib memory allocation and free functions 2011-08-20 23:01:08 -05:00
cow.c block: Allow bdrv_flush to return errors 2010-11-04 12:52:16 +01:00
curl.c block/curl: Don't finish AIOCBs too early 2011-09-21 15:16:04 +02:00
dmg.c Use glib memory allocation and free functions 2011-08-20 23:01:08 -05:00
nbd.c nbd: support feature negotiation 2011-09-19 11:34:33 +02:00
parallels.c Use new macro QEMU_PACKED for packed structures 2011-09-03 10:45:59 +00:00
qcow2-cache.c Use glib memory allocation and free functions 2011-08-20 23:01:08 -05:00
qcow2-cluster.c qcow2: Fix bdrv_write_compressed error handling 2011-10-21 17:34:13 +02:00
qcow2-refcount.c qcow2: remove unused qcow2_create_refcount_update function 2011-08-25 15:23:10 +02:00
qcow2-snapshot.c Use new macro QEMU_PACKED for packed structures 2011-09-03 10:45:59 +00:00
qcow2.c qcow2: Fix bdrv_write_compressed error handling 2011-10-21 17:34:13 +02:00
qcow2.h qcow2: removed unused depends_on field 2011-09-12 15:17:17 +02:00
qcow.c block: drop redundant bdrv_flush implementation 2011-10-21 17:34:13 +02:00
qed-check.c Use glib memory allocation and free functions 2011-08-20 23:01:08 -05:00
qed-cluster.c Use glib memory allocation and free functions 2011-08-20 23:01:08 -05:00
qed-gencb.c Use glib memory allocation and free functions 2011-08-20 23:01:08 -05:00
qed-l2-cache.c Use glib memory allocation and free functions 2011-08-20 23:01:08 -05:00
qed-table.c qed: fix use-after-free during l2 cache commit 2011-10-05 10:52:31 -05:00
qed.c block: drop redundant bdrv_flush implementation 2011-10-21 17:34:13 +02:00
qed.h qed: Periodically flush and clear need check bit 2011-05-18 14:38:46 +02:00
raw-posix-aio.h Remove aio_ctx from paio_* interface 2009-10-30 08:39:34 -05:00
raw-posix.c block: drop redundant bdrv_flush implementation 2011-10-21 17:34:13 +02:00
raw-win32.c w32: Fix qemu_ftruncate64 2011-08-22 10:19:00 -05:00
raw.c block: add bdrv_co_discard and bdrv_aio_discard support 2011-10-21 17:34:13 +02:00
rbd.c rbd: allow escaping in config string 2011-09-20 14:34:17 +02:00
sheepdog.c sheepdog: add coroutine_fn markers 2011-10-21 17:34:12 +02:00
vdi.c Use glib memory allocation and free functions 2011-08-20 23:01:08 -05:00
vmdk.c vmdk: clean up open 2011-10-21 17:34:13 +02:00
vpc.c Use glib memory allocation and free functions 2011-08-20 23:01:08 -05:00
vvfat.c vvfat: Fix potential buffer overflow 2011-10-11 09:42:46 +02:00