From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60218) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bnQCK-0004LN-Oi for qemu-devel@nongnu.org; Fri, 23 Sep 2016 09:07:25 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bnQCG-0003s0-Ja for qemu-devel@nongnu.org; Fri, 23 Sep 2016 09:07:24 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35730) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bnQCG-0003rk-Dg for qemu-devel@nongnu.org; Fri, 23 Sep 2016 09:07:20 -0400 Date: Fri, 23 Sep 2016 14:07:17 +0100 From: Stefan Hajnoczi Message-ID: <20160923130717.GL8221@stefanha-x1.localdomain> References: <147447700612.30952.9420141963781948805.stgit@bahia> <147447704939.30952.17919307218318456297.stgit@bahia> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="oY1uq2ONqt5kuovO" Content-Disposition: inline In-Reply-To: <147447704939.30952.17919307218318456297.stgit@bahia> Subject: Re: [Qemu-devel] [PATCH v2 5/9] virtio-net: handle virtio_net_handle_ctrl() error List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Greg Kurz Cc: qemu-devel@nongnu.org, Kevin Wolf , "Michael S. Tsirkin" , Jason Wang , Max Reitz , "Aneesh Kumar K.V" , Cornelia Huck , Paolo Bonzini --oY1uq2ONqt5kuovO Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Sep 21, 2016 at 06:57:29PM +0200, Greg Kurz wrote: > This error is caused by a buggy guest: let's switch the device to the > broken state instead of terminating QEMU. >=20 > Signed-off-by: Greg Kurz > --- > v2: - s/return/break in virtio_net_handle_ctrl() for consistency's sake > --- > hw/net/virtio-net.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/hw/net/virtio-net.c b/hw/net/virtio-net.c > index 01f1351554aa..8a6f1d952467 100644 > --- a/hw/net/virtio-net.c > +++ b/hw/net/virtio-net.c > @@ -892,8 +892,8 @@ static void virtio_net_handle_ctrl(VirtIODevice *vdev= , VirtQueue *vq) > } > if (iov_size(elem->in_sg, elem->in_num) < sizeof(status) || > iov_size(elem->out_sg, elem->out_num) < sizeof(ctrl)) { > - error_report("virtio-net ctrl missing headers"); > - exit(1); > + virtio_error(vdev, "virtio-net ctrl missing headers"); > + break; We must detach and free elem to avoid leaks. --oY1uq2ONqt5kuovO Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEcBAEBAgAGBQJX5SkFAAoJEJykq7OBq3PIAcQH+wSVd/JEke0edgN5+g+LFuPj 2JNn2C9b1hYBLspOc9MaEkAY54Uy8Zcc/txf+GOFvm+3O5c6YyhyN67J3VVHm9kR NoqWPrMnoua8pJXQeSMivMpNsegmh0bI5h2mzgQOIi5ur3Bl8+iOmhWEwtdvZLNO QMNdRTMV/1ncSJKWGWKEYAJluKTo+4TwmTQ8Lt+hxRZU3/+E1fEpm1O13CV7szSG BmOxZnIbbv4Cu/gYde5dLS43+fVdj5m+1eYQUIH288JIDgbVB6pNcbGXcNhrbgj8 QeW3mSa+vXMx0eK9ABVQodC5glAcJ5k3yUn5BPtb5nQs3XCvhPEWeC9q372L5j4= =oca/ -----END PGP SIGNATURE----- --oY1uq2ONqt5kuovO--