From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49452) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Ve03l-0004YD-0N for qemu-devel@nongnu.org; Wed, 06 Nov 2013 05:10:06 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Ve03e-0000CG-NX for qemu-devel@nongnu.org; Wed, 06 Nov 2013 05:10:00 -0500 Sender: Paolo Bonzini Message-ID: <527A156A.20807@redhat.com> Date: Wed, 06 Nov 2013 11:09:46 +0100 From: Paolo Bonzini MIME-Version: 1.0 References: <1383728288-28469-1-git-send-email-jasowang@redhat.com> In-Reply-To: <1383728288-28469-1-git-send-email-jasowang@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 1.7] virtio-net: only delete bh that existed List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jason Wang Cc: qemu-stable@nongnu.org, qemu-devel@nongnu.org, aliguori@amazon.com, mst@redhat.com Il 06/11/2013 09:58, Jason Wang ha scritto: > 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 > --- > 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); > } > } > Please remember to add 1.7 in the subject at this time. Paolo