[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH] Don't allow multiwrites against a block device with
From: |
Ryan Harper |
Subject: |
[Qemu-devel] [PATCH] Don't allow multiwrites against a block device without underlying medium |
Date: |
Wed, 2 Mar 2011 09:04:22 -0600 |
User-agent: |
Mutt/1.5.6+20040907i |
If the block device has been closed, we no longer have a medium to submit
IO against, check for this before submitting io. This prevents a segfault
further in the code where we dereference elements of the block driver.
Signed-off-by: Ryan Harper <address@hidden>
---
block.c | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/block.c b/block.c
index 92dd3fe..534e1bc 100644
--- a/block.c
+++ b/block.c
@@ -2407,6 +2407,11 @@ int bdrv_aio_multiwrite(BlockDriverState *bs,
BlockRequest *reqs, int num_reqs)
return 0;
}
+ /* don't submit writes if we don't have a medium */
+ if (bs->drv == NULL) {
+ return -1;
+ }
+
// Create MultiwriteCB structure
mcb = qemu_mallocz(sizeof(*mcb) + num_reqs * sizeof(*mcb->callbacks));
mcb->num_requests = 0;
--
1.7.1
--
Ryan Harper
Software Engineer; Linux Technology Center
IBM Corp., Austin, Tx
address@hidden
- [Qemu-devel] [PATCH] Don't allow multiwrites against a block device without underlying medium,
Ryan Harper <=