From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38157) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGBg8-000431-Ds for qemu-devel@nongnu.org; Mon, 04 Jan 2016 15:24:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aGBg5-00052D-MP for qemu-devel@nongnu.org; Mon, 04 Jan 2016 15:24:32 -0500 Received: from mx1.redhat.com ([209.132.183.28]:59204) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aGBg5-00051s-EJ for qemu-devel@nongnu.org; Mon, 04 Jan 2016 15:24:29 -0500 References: <20151229133835.25580.50152.malonedeb@soybean.canonical.com> From: Eric Blake Message-ID: <568AD4F7.6090702@redhat.com> Date: Mon, 4 Jan 2016 13:24:23 -0700 MIME-Version: 1.0 In-Reply-To: <20151229133835.25580.50152.malonedeb@soybean.canonical.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="HkPFoWgfOM8dOFInqilv60W1LXknMTBeH" Subject: Re: [Qemu-devel] [Bug 1529859] [NEW] qemu 2.5.0 ivshmem segfault with msi=off option List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Bug 1529859 <1529859@bugs.launchpad.net>, qemu-devel@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --HkPFoWgfOM8dOFInqilv60W1LXknMTBeH Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 12/29/2015 06:38 AM, maquefel wrote: > Public bug reported: >=20 > Launching qemu with "-device ivshmem,chardev=3Divshmemid,msi=3Doff -cha= rdev > socket,path=3D/tmp/ivshmem_socket,id=3Divshmemid" >=20 > Causes segfault because, s->msi_vectors is not initialized and > s->msi_vectors =3D=3D 0. >=20 > Does ivshmem exactly need this line ? : >=20 > s->msi_vectors[vector].pdev =3D pdev; >=20 > It makes no sence for me. >=20 > Subject: [PATCH] fixed ivshmem empty msi vector on msi=3Doff segfault Patches require a Signed-off-by: line before they can be applied. >=20 > --- > hw/misc/ivshmem.c | 9 ++++----- > 1 file changed, 4 insertions(+), 5 deletions(-) >=20 > diff --git a/hw/misc/ivshmem.c b/hw/misc/ivshmem.c > index f73f0c2..2087d5e 100644 > --- a/hw/misc/ivshmem.c > +++ b/hw/misc/ivshmem.c > @@ -359,8 +359,6 @@ static CharDriverState* create_eventfd_chr_device(v= oid * opaque, EventNotifier * > int eventfd =3D event_notifier_get_fd(n); > CharDriverState *chr; > =20 > - s->msi_vectors[vector].pdev =3D pdev; > - This avoids the segfault, but it may break other uses. Are you sure you don't need an 'if (s->msi_vectors[vector])' conditional? > chr =3D qemu_chr_open_eventfd(eventfd); > =20 > if (chr =3D=3D NULL) { > @@ -1038,10 +1036,11 @@ static void pci_ivshmem_exit(PCIDevice *dev) > } > =20 > if (ivshmem_has_feature(s, IVSHMEM_MSI)) { > - msix_uninit_exclusive_bar(dev); > + msix_uninit_exclusive_bar(dev); I can't see what's changing here. Whitespace? > } > - > - g_free(s->msi_vectors); > + =20 > + if(s->msi_vectors) > + g_free(s->msi_vectors); This hunk is bogus. g_free(NULL) already works properly. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --HkPFoWgfOM8dOFInqilv60W1LXknMTBeH Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWitT3AAoJEKeha0olJ0Nqy3MH/0JWXPWWY/bYjv/nwvvA3b0D IV32BvUcE1buP3/JK49JNV56wdiA6DB4+QK3DD66m0f+a2Ru9IDv9jUjqmyi2++c zuK1NpIILuiagKQ0j+ByEK/0FG9b9NjbpIuPTHCDhEOYJw2n73EnZm514890RjDi MdMMsF45xGjkz0GQ3xeiUqlFi0C6WXH+XWUoYfJ9GldmcGfODuP8eg6r0O2/enUE NbJDZ86NjcOt5wW1JlPnPMGTFFZORO6x2RdBwwI8P3y/QtLjJSKuajybZXU3emGq bphTZfof0yVUwqraqfz6qC2gTdYwhBHv0w0sWtHyYBgW302vccN2twTbYvmWFl0= =L+Fx -----END PGP SIGNATURE----- --HkPFoWgfOM8dOFInqilv60W1LXknMTBeH--