1. 25 8月, 2017 3 次提交
  2. 04 8月, 2017 15 次提交
  3. 01 8月, 2017 4 次提交
  4. 18 4月, 2017 1 次提交
    • F
      block: Walk bs->children carefully in bdrv_drain_recurse · 178bd438
      Fam Zheng 提交于
      The recursive bdrv_drain_recurse may run a block job completion BH that
      drops nodes. The coming changes will make that more likely and use-after-free
      would happen without this patch
      
      Stash the bs pointer and use bdrv_ref/bdrv_unref in addition to
      QLIST_FOREACH_SAFE to prevent such a case from happening.
      
      Since bdrv_unref accesses global state that is not protected by the AioContext
      lock, we cannot use bdrv_ref/bdrv_unref unconditionally.  Fortunately the
      protection is not needed in IOThread because only main loop can modify a graph
      with the AioContext lock held.
      Signed-off-by: NFam Zheng <famz@redhat.com>
      Message-Id: <20170418143044.12187-2-famz@redhat.com>
      Reviewed-by: NJeff Cody <jcody@redhat.com>
      Tested-by: NJeff Cody <jcody@redhat.com>
      Signed-off-by: NFam Zheng <famz@redhat.com>
      178bd438
  5. 11 4月, 2017 9 次提交
  6. 07 4月, 2017 6 次提交
  7. 03 4月, 2017 2 次提交
    • M
      block/parallels: Avoid overflows · 86d1bd70
      Max Reitz 提交于
      Change the types of variables in allocate_clusters() to int64_t so we do
      not have to worry about potential overflows.
      
      Add an assertion that our accesses to s->bat[] do not result in a buffer
      overflow and that the implicit conversion performed when invoking
      bat_entry_off() does not result in an integer overflow.
      
      Coverity-id: 1307776
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      Message-id: 20170331170512.10381-1-mreitz@redhat.com
      Reviewed-by: NEric Blake <eblake@redhat.com>
      Reviewed-by: NPhilippe Mathieu-Daudé <f4bug@amsat.org>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      86d1bd70
    • E
      qcow2: Discard unaligned tail when wiping image · 0c1bd469
      Eric Blake 提交于
      There is a subtle difference between the fast (qcow2v3 with no
      extra data) and slow path (qcow2v2 format [aka 0.10], or when a
      snapshot is present) of qcow2_make_empty().  The slow path fails
      to discard the final (partial) cluster of an unaligned image.
      
      The problem stems from the fact that qcow2_discard_clusters() was
      silently ignoring sub-cluster head and tail on unaligned requests.
      A quick audit of all callers shows that qcow2_snapshot_create() has
      always passed a cluster-aligned request since the call was added
      in commit 1ebf561c; qcow2_co_pdiscard() has passed a cluster-aligned
      request since commit ecdbead6 taught the block layer about preferred
      discard alignment; and qcow2_make_empty() was fixed to pass an
      aligned start (but not necessarily end) in commit a3e1505d.
      
      Asserting that the start is always aligned also points out that we
      now have a dead check: rounding the end offset down can never result
      in a value less than the aligned start offset (the check was rendered
      dead with commit ecdbead6).  Meanwhile, we do not want to round the
      end cluster down in the one case of the end offset matching the
      (unaligned) file size - that final partial cluster should still be
      discarded.
      
      With those fixes in place, the fast and slow paths are back in sync
      at discarding an entire image; the next patch will update
      qemu-iotests to ensure we don't regress.
      
      Note that bdrv_co_pdiscard ignores ALL partial cluster requests,
      including the partial cluster at the end of an image; it can be
      argued that the partial cluster at the end should be special-cased
      so that a guest issuing discard requests at proper alignments
      everywhere else can likewise empty the entire image.  But that
      optimization is left for another day.
      Signed-off-by: NEric Blake <eblake@redhat.com>
      Message-id: 20170331185356.2479-3-eblake@redhat.com
      Reviewed-by: NMax Reitz <mreitz@redhat.com>
      Signed-off-by: NMax Reitz <mreitz@redhat.com>
      0c1bd469