All of lore.kernel.org
 help / color / mirror / Atom feed
From: Anthony Liguori <aliguori@us.ibm.com>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] check for bs->drv in bdrv_flush
Date: Sat, 28 Mar 2009 20:32:35 -0500	[thread overview]
Message-ID: <49CECFB3.8010407@us.ibm.com> (raw)
In-Reply-To: <20090328183916.GA25875@lst.de>

Christoph Hellwig wrote:
> All the bdrv_ helpers should check for bs->drv being zero as that means
> there is no backend image open.  bdrv_flush fails to perform that check
> and can thus cause NULL pointer dereferences.
>
> Found using qemu-io.
>   

Applied.  Thanks.

FWIW, I plan to include qemu-io once you rebase the series to use 
IOVectors instead of struct iovec.  It looks like a useful tool!

Regards,

Anthony Liguori

> Signed-off-by: Christoph Hellwig <hch@lst.de>
>
> Index: qemu/block.c
> ===================================================================
> --- qemu.orig/block.c	2009-03-19 21:48:12.180978074 +0100
> +++ qemu/block.c	2009-03-19 21:48:53.228977807 +0100
> @@ -979,6 +979,8 @@ const char *bdrv_get_device_name(BlockDr
>  
>  void bdrv_flush(BlockDriverState *bs)
>  {
> +    if (!bs->drv)
> +        return;
>      if (bs->drv->bdrv_flush)
>          bs->drv->bdrv_flush(bs);
>      if (bs->backing_hd)
>
>
>
>
>   

  reply	other threads:[~2009-03-29  1:32 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-28 18:39 [Qemu-devel] [PATCH] check for bs->drv in bdrv_flush Christoph Hellwig
2009-03-29  1:32 ` Anthony Liguori [this message]
2009-03-29  7:31   ` Christoph Hellwig

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=49CECFB3.8010407@us.ibm.com \
    --to=aliguori@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.