From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:32769) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZg1e-0004VE-KM for qemu-devel@nongnu.org; Tue, 07 May 2013 07:25:45 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UZg1b-0004LH-Jr for qemu-devel@nongnu.org; Tue, 07 May 2013 07:25:42 -0400 Received: from mx1.redhat.com ([209.132.183.28]:38309) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UZg1b-0004L9-Bv for qemu-devel@nongnu.org; Tue, 07 May 2013 07:25:39 -0400 Date: Tue, 7 May 2013 14:25:33 +0300 From: "Michael S. Tsirkin" Message-ID: <20130507112533.GC19121@redhat.com> References: <1366972060-21606-1-git-send-email-jasowang@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1366972060-21606-1-git-send-email-jasowang@redhat.com> Subject: Re: [Qemu-devel] [PATCH] virtio-net: properly check the vhost status during status set List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Jason Wang Cc: aliguori@us.ibm.com, qemu-devel@nongnu.org On Fri, Apr 26, 2013 at 06:27:40PM +0800, Jason Wang wrote: > Commit 32993698 (vhost: disable on tap link down) tries to disable the vhost > also when the peer's link is down. But the check was not done properly, the > vhost were only started when: > > 1) peer's link is not down > 2) virtio-net has already been started. > > Since == have a higher precedence than &&, place a brace to make sure both the > conditions were met then does the check. This fixes the crash when doing a savem > after set the link off which let qemu crash and complains: > > virtio_net_save: Assertion `!n->vhost_started' failed. > > Cc: Michael S. Tsirkin > Signed-off-by: Jason Wang Acked-by: Michael S. Tsirkin Reviewed-by: Michael S. Tsirkin Too late for 1.5? > --- > hw/net/virtio-net.c | 4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c > index 4d2cdd2..6222039 100644 > --- a/hw/net/virtio-net.c > +++ b/hw/net/virtio-net.c > @@ -114,8 +114,8 @@ static void virtio_net_vhost_status(VirtIONet *n, uint8_t status) > return; > } > > - if (!!n->vhost_started == virtio_net_started(n, status) && > - !nc->peer->link_down) { > + if (!!n->vhost_started == > + (virtio_net_started(n, status) && !nc->peer->link_down)) { > return; > } > if (!n->vhost_started) { > -- > 1.7.1