From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:57951) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1VeFui-0005Kr-Ol for qemu-devel@nongnu.org; Wed, 06 Nov 2013 22:05:49 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1VeFud-0006eA-LG for qemu-devel@nongnu.org; Wed, 06 Nov 2013 22:05:44 -0500 Message-ID: <527B0307.1090403@redhat.com> Date: Thu, 07 Nov 2013 11:03:35 +0800 From: Jason Wang MIME-Version: 1.0 References: <1383728288-28469-1-git-send-email-jasowang@redhat.com> <20131106111704.GA29363@redhat.com> In-Reply-To: <20131106111704.GA29363@redhat.com> Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH] virtio-net: only delete bh that existed List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: "Michael S. Tsirkin" Cc: qemu-devel@nongnu.org, aliguori@amazon.com, qemu-stable@nongnu.org On 11/06/2013 07:17 PM, Michael S. Tsirkin wrote: > 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 > Reviewed-by: Michael S. Tsirkin > > Looks like the bug was introduced by: > commit 17ec5a8686143da66208273d355f2eeb09807614 > Author: KONRAD Frederic > 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? > Nope, it was introduced in the multiqueue virito-net, since the bh were created conditionally from that commit. commit fed699f9ca6ae8a0fb62803334cf46fa64d1eb91 Author: Jason Wang Date: Wed Jan 30 19:12:39 2013 +0800 virtio-net: multiqueue support > >> --- >> 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