All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Jason Wang <jasowang@redhat.com>
Cc: qemu-devel@nongnu.org, aliguori@amazon.com, qemu-stable@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] virtio-net: only delete bh that existed
Date: Wed, 6 Nov 2013 13:17:04 +0200	[thread overview]
Message-ID: <20131106111704.GA29363@redhat.com> (raw)
In-Reply-To: <1383728288-28469-1-git-send-email-jasowang@redhat.com>

On Wed, Nov 06, 2013 at 04:58:08PM +0800, Jason Wang wrote:
> We delete without check whether it existed during exit. This will lead NULL
> pointer deference since it was created conditionally depends on guest driver
> status and features. So add a check of existence before trying to delete it.
> 
> Cc: qemu-stable@nongnu.org
> Signed-off-by: Jason Wang <jasowang@redhat.com>

Reviewed-by: Michael S. Tsirkin <mst@redhat.com>

Looks like the bug was introduced by:
	commit 17ec5a8686143da66208273d355f2eeb09807614
	Author: KONRAD Frederic <fred.konrad@greensocs.com>
	Date:   Thu Apr 11 16:29:57 2013 +0200
	    virtio-net: add the virtio-net device.

Before that we had a single bh and created/destroyed
that unconditionally.
Is this a correct analysis?



> ---
>  hw/net/virtio-net.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c
> index 22dbd05..ae51d96 100644
> --- a/hw/net/virtio-net.c
> +++ b/hw/net/virtio-net.c
> @@ -1601,7 +1601,7 @@ static int virtio_net_device_exit(DeviceState *qdev)
>          if (q->tx_timer) {
>              timer_del(q->tx_timer);
>              timer_free(q->tx_timer);
> -        } else {
> +        } else if (q->tx_bh) {
>              qemu_bh_delete(q->tx_bh);
>          }
>      }
> -- 
> 1.8.3.2

  parent reply	other threads:[~2013-11-06 11:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-06  8:58 [Qemu-devel] [PATCH] virtio-net: only delete bh that existed Jason Wang
2013-11-06 10:09 ` [Qemu-devel] [PATCH 1.7] " Paolo Bonzini
2013-11-06 11:17 ` Michael S. Tsirkin [this message]
2013-11-07  3:03   ` [Qemu-devel] [PATCH] " Jason Wang

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=20131106111704.GA29363@redhat.com \
    --to=mst@redhat.com \
    --cc=aliguori@amazon.com \
    --cc=jasowang@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-stable@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.