From: Ryan Harper <ryanh@us.ibm.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH] Don't allow multiwrites against a block device without underlying medium
Date: Wed, 2 Mar 2011 09:04:22 -0600 [thread overview]
Message-ID: <20110302150422.GA13257@us.ibm.com> (raw)
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 <ryanh@us.ibm.com>
---
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
ryanh@us.ibm.com
next reply other threads:[~2011-03-02 15:04 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-02 15:04 Ryan Harper [this message]
2011-03-03 10:12 ` [Qemu-devel] [PATCH] Don't allow multiwrites against a block device without underlying medium Stefan Hajnoczi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20110302150422.GA13257@us.ibm.com \
--to=ryanh@us.ibm.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).