[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 03/24] qcow2: Check bs->drv in copy_sectors()
From: |
Stefan Hajnoczi |
Subject: |
[Qemu-devel] [PULL 03/24] qcow2: Check bs->drv in copy_sectors() |
Date: |
Wed, 12 Mar 2014 11:29:11 +0100 |
From: Max Reitz <address@hidden>
Before dereferencing bs->drv for a call to its member bdrv_co_readv(),
copy_sectors() should check whether that pointer is indeed valid, since
it may have been set to NULL by e.g. a concurrent write triggering the
corruption prevention mechanism.
Signed-off-by: Max Reitz <address@hidden>
Signed-off-by: Stefan Hajnoczi <address@hidden>
---
block/qcow2-cluster.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/block/qcow2-cluster.c b/block/qcow2-cluster.c
index 36c1bed..9499df9 100644
--- a/block/qcow2-cluster.c
+++ b/block/qcow2-cluster.c
@@ -380,6 +380,10 @@ static int coroutine_fn copy_sectors(BlockDriverState *bs,
BLKDBG_EVENT(bs->file, BLKDBG_COW_READ);
+ if (!bs->drv) {
+ return -ENOMEDIUM;
+ }
+
/* Call .bdrv_co_readv() directly instead of using the public block-layer
* interface. This avoids double I/O throttling and request tracking,
* which can lead to deadlock when block layer copy-on-read is enabled.
--
1.8.5.3
- [Qemu-devel] [PULL 04/24] block: bs->drv may be NULL in bdrv_debug_resume(), (continued)
- [Qemu-devel] [PULL 04/24] block: bs->drv may be NULL in bdrv_debug_resume(), Stefan Hajnoczi, 2014/03/12
- [Qemu-devel] [PULL 06/24] block: Rewrite the snapshot authorization mechanism for block filters., Stefan Hajnoczi, 2014/03/12
- [Qemu-devel] [PULL 07/24] object: add object_get_canonical_path_component(), Stefan Hajnoczi, 2014/03/12
- [Qemu-devel] [PULL 08/24] rfifolock: add recursive FIFO lock, Stefan Hajnoczi, 2014/03/12
- [Qemu-devel] [PULL 10/24] iothread: add I/O thread object, Stefan Hajnoczi, 2014/03/12
- [Qemu-devel] [PULL 09/24] aio: add aio_context_acquire() and aio_context_release(), Stefan Hajnoczi, 2014/03/12
- [Qemu-devel] [PULL 12/24] iothread: add "iothread" qdev property type, Stefan Hajnoczi, 2014/03/12
- [Qemu-devel] [PULL 13/24] dataplane: replace internal thread with IOThread, Stefan Hajnoczi, 2014/03/12
- [Qemu-devel] [PULL 17/24] qcow2: Don't write with BDRV_O_INCOMING, Stefan Hajnoczi, 2014/03/12
- [Qemu-devel] [PULL 14/24] iothread: stash thread ID away, Stefan Hajnoczi, 2014/03/12
- [Qemu-devel] [PULL 03/24] qcow2: Check bs->drv in copy_sectors(),
Stefan Hajnoczi <=
- [Qemu-devel] [PULL 05/24] iotests: Test corruption during COW request, Stefan Hajnoczi, 2014/03/12
- [Qemu-devel] [PULL 11/24] qdev: make get_pointer() handle temporary strings, Stefan Hajnoczi, 2014/03/12
- [Qemu-devel] [PULL 15/24] qmp: add query-iothreads command, Stefan Hajnoczi, 2014/03/12
- [Qemu-devel] [PULL 21/24] block/raw-posix: bdrv_parse_filename() for floppy, Stefan Hajnoczi, 2014/03/12
- [Qemu-devel] [PULL 19/24] qemu-io: Fix warnings from static code analysis, Stefan Hajnoczi, 2014/03/12
- [Qemu-devel] [PULL 24/24] block/raw-win32: bdrv_parse_filename() for hdev, Stefan Hajnoczi, 2014/03/12
- [Qemu-devel] [PULL 16/24] qcow2: Keep option in qcow2_invalidate_cache(), Stefan Hajnoczi, 2014/03/12
- [Qemu-devel] [PULL 18/24] block: Unlink temporary file, Stefan Hajnoczi, 2014/03/12
- [Qemu-devel] [PULL 20/24] block/raw-posix: bdrv_parse_filename() for hdev, Stefan Hajnoczi, 2014/03/12
- [Qemu-devel] [PULL 22/24] block/raw-posix: bdrv_parse_filename() for cdrom, Stefan Hajnoczi, 2014/03/12