On 02/13/2018 08:21 AM, Stefan Hajnoczi wrote:
BlockBackend currently relies on BlockDriverState->in_flight to track
requests for blk_drain().  There is a corner case where
BlockDriverState->in_flight cannot be used though: blk->root can be NULL
when there is no medium.  This results in a segfault when the NULL
pointer is dereferenced.

Introduce a BlockBackend->in_flight counter for aio requests so it works
even when blk->root == NULL.

Based on a patch by Kevin Wolf <kw...@redhat.com>.

Signed-off-by: Kevin Wolf <kw...@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefa...@redhat.com>
  block.c               |  2 +-
  block/block-backend.c | 60 +++++++++++++++++++++++++++++++++++++++++++++------
  2 files changed, 54 insertions(+), 8 deletions(-)

Reviewed-by: Eric Blake <ebl...@redhat.com>

Eric Blake, Principal Software Engineer
Red Hat, Inc.           +1-919-301-3266
Virtualization:  qemu.org | libvirt.org

Reply via email to