qemu-e2k/block
Fam Zheng 178bd438af block: Walk bs->children carefully in bdrv_drain_recurse
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: Fam Zheng <famz@redhat.com>
Message-Id: <20170418143044.12187-2-famz@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Tested-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
2017-04-18 22:56:28 +08:00
..
accounting.c
backup.c
blkdebug.c
blkreplay.c
blkverify.c
block-backend.c throttle: Remove block from group on hot-unplug 2017-04-11 15:33:00 +02:00
bochs.c
cloop.c
commit.c commit: Set commit_top_bs->total_sectors 2017-04-07 14:44:05 +02:00
crypto.c
curl.c block/curl: Check protocol prefix 2017-03-31 15:53:22 -04:00
dirty-bitmap.c
dmg-bz2.c
dmg.c
dmg.h
file-posix.c block: Document -drive problematic code and bugs 2017-04-03 17:11:39 +02:00
file-win32.c
gluster.c qapi-schema: SocketAddressFlat variants 'vsock' and 'fd' 2017-04-03 17:11:39 +02:00
io.c block: Walk bs->children carefully in bdrv_drain_recurse 2017-04-18 22:56:28 +08:00
iscsi-opts.c
iscsi.c iscsi: Fix iscsi_create 2017-04-11 15:33:00 +02:00
linux-aio.c
Makefile.objs
mirror.c mirror: Fix aio context of mirror_top_bs 2017-04-07 14:44:06 +02:00
nbd-client.c
nbd-client.h
nbd.c * MemoryRegionCache revert 2017-04-04 11:40:55 +01:00
nfs.c block: Document -drive problematic code and bugs 2017-04-03 17:11:39 +02:00
null.c
parallels.c block/parallels: Avoid overflows 2017-04-03 17:11:40 +02:00
qapi.c
qcow2-cache.c
qcow2-cluster.c qcow2: Discard unaligned tail when wiping image 2017-04-03 17:11:40 +02:00
qcow2-refcount.c
qcow2-snapshot.c
qcow2.c
qcow2.h
qcow.c
qed-check.c
qed-cluster.c
qed-gencb.c
qed-l2-cache.c
qed-table.c
qed.c
qed.h
quorum.c
raw-format.c
rbd.c block: Document -drive problematic code and bugs 2017-04-03 17:11:39 +02:00
replication.c
sheepdog.c sheepdog: Fix crash in co_read_response() 2017-04-11 16:08:29 +01:00
snapshot.c block: pass the right options for BlockDriver.bdrv_open() 2017-04-11 15:33:00 +02:00
ssh.c block: Document -drive problematic code and bugs 2017-04-03 17:11:39 +02:00
stream.c
throttle-groups.c
trace-events
vdi.c
vhdx-endian.c
vhdx-log.c
vhdx.c
vhdx.h
vmdk.c
vpc.c
vvfat.c
win32-aio.c
write-threshold.c