From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from [140.186.70.92] (port=46619 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1PlKXd-0001Hc-5F for qemu-devel@nongnu.org; Fri, 04 Feb 2011 07:13:37 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1PlKX8-0007h9-PR for qemu-devel@nongnu.org; Fri, 04 Feb 2011 07:13:03 -0500 Received: from mx1.redhat.com ([209.132.183.28]:2157) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1PlKX8-0007h0-G3 for qemu-devel@nongnu.org; Fri, 04 Feb 2011 07:13:02 -0500 From: Juan Quintela In-Reply-To: (Amit Shah's message of "Fri, 4 Feb 2011 14:24:18 +0530") References: Date: Fri, 04 Feb 2011 13:11:48 +0100 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Subject: [Qemu-devel] Re: [PATCH master/0.14] virtio-serial: Make sure virtqueue is ready before discarding data Reply-To: quintela@redhat.com List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Amit Shah Cc: qemu list Amit Shah wrote: > This can happen if a port gets unplugged before guest has chance to > initialise vqs. > > Reported-by: Juan Quintela > Signed-off-by: Amit Shah > --- > hw/virtio-serial-bus.c | 3 +++ > 1 files changed, 3 insertions(+), 0 deletions(-) > > diff --git a/hw/virtio-serial-bus.c b/hw/virtio-serial-bus.c > index 09e22aa..e05ab5e 100644 > --- a/hw/virtio-serial-bus.c > +++ b/hw/virtio-serial-bus.c > @@ -117,6 +117,9 @@ static void discard_vq_data(VirtQueue *vq, VirtIODevice *vdev) > { > VirtQueueElement elem; > > + if (!virtio_queue_ready(vq)) { > + return; > + } > while (virtqueue_pop(vq, &elem)) { > virtqueue_push(vq, &elem, 0); > } Reviewed-by: Juan Quintela