qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jan Kiszka <jan.kiszka@siemens.com>
To: Anthony Liguori <aliguori@us.ibm.com>
Cc: qemu-devel <qemu-devel@nongnu.org>,
	Luiz Capitulino <lcapitulino@redhat.com>
Subject: [Qemu-devel] [PATCH] virtio-blk: Fix use after release in virtio_blk_handle_rw_error
Date: Wed, 07 Apr 2010 13:47:47 +0200	[thread overview]
Message-ID: <4BBC70E3.6010609@siemens.com> (raw)

virtio_blk_req_complete releases the request we dereference again for
bdrv_mon_event. Reorder both calls to fix this.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 hw/virtio-blk.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/hw/virtio-blk.c b/hw/virtio-blk.c
index 9915840..d5e8c79 100644
--- a/hw/virtio-blk.c
+++ b/hw/virtio-blk.c
@@ -76,8 +76,8 @@ static int virtio_blk_handle_rw_error(VirtIOBlockReq *req, int error,
         bdrv_mon_event(req->dev->bs, BDRV_ACTION_STOP, is_read);
         vm_stop(0);
     } else {
-        virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR);
         bdrv_mon_event(req->dev->bs, BDRV_ACTION_REPORT, is_read);
+        virtio_blk_req_complete(req, VIRTIO_BLK_S_IOERR);
     }
 
     return 1;

             reply	other threads:[~2010-04-07 11:47 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-07 11:47 Jan Kiszka [this message]
2010-04-07 11:57 ` [Qemu-devel] [PATCH] virtio-blk: Fix use after release in virtio_blk_handle_rw_error Christoph Hellwig
2010-04-07 12:18   ` Kevin Wolf
2010-04-07 12:32     ` Luiz Capitulino
2010-04-07 12:33       ` Luiz Capitulino

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=4BBC70E3.6010609@siemens.com \
    --to=jan.kiszka@siemens.com \
    --cc=aliguori@us.ibm.com \
    --cc=lcapitulino@redhat.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).