From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:36371) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmFyy-0007ZM-0o for qemu-devel@nongnu.org; Thu, 06 Nov 2014 00:51:53 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XmFyo-0006Co-W2 for qemu-devel@nongnu.org; Thu, 06 Nov 2014 00:51:43 -0500 Received: from mail-pd0-x22e.google.com ([2607:f8b0:400e:c02::22e]:34972) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XmFyo-0006Cj-Ny for qemu-devel@nongnu.org; Thu, 06 Nov 2014 00:51:34 -0500 Received: by mail-pd0-f174.google.com with SMTP id p10so470916pdj.19 for ; Wed, 05 Nov 2014 21:51:33 -0800 (PST) Date: Thu, 6 Nov 2014 13:51:25 +0800 From: Amos Kong Message-ID: <20141106055125.GD8764@air.redhat.com> References: <1415198594-32581-1-git-send-email-marcandre.lureau@gmail.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="veXX9dWIonWZEC6h" Content-Disposition: inline In-Reply-To: <1415198594-32581-1-git-send-email-marcandre.lureau@gmail.com> Subject: Re: [Qemu-devel] [PATCHv2] virtio-serial: avoid crash when port has no name List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: =?iso-8859-1?Q?Marc-Andr=E9?= Lureau Cc: amit.shah@redhat.com, qemu-devel@nongnu.org --veXX9dWIonWZEC6h Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Nov 05, 2014 at 03:43:14PM +0100, Marc-Andr=E9 Lureau wrote: > It seems "name" is not mandatory, and the following command line (based > on one generated by current libvirt) will crash qemu at start: >=20 > qemu-system-x86_64 \ > -device virtio-serial-pci \ > -device virtserialport,name=3Dfoo \ > -device virtconsole >=20 > Program received signal SIGSEGV, Segmentation fault. > __strcmp_ssse3 () at ../sysdeps/x86_64/strcmp.S:210 > 210 movlpd (%rsi), %xmm2 > Missing separate debuginfos, use: debuginfo-install > python-libs-2.7.5-13.fc20.x86_64 > (gdb) bt > #0 __strcmp_ssse3 () at ../sysdeps/x86_64/strcmp.S:210 > #1 0x000055555566bdc6 in find_port_by_name (name=3D0x0) at /home/elmarc= o/src/qemu/hw/char/virtio-serial-bus.c:67 >=20 > Signed-off-by: Marc-Andr=E9 Lureau > --- > hw/char/virtio-serial-bus.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/hw/char/virtio-serial-bus.c b/hw/char/virtio-serial-bus.c > index 3931085..f16452e 100644 > --- a/hw/char/virtio-serial-bus.c > +++ b/hw/char/virtio-serial-bus.c > @@ -871,7 +871,7 @@ static void virtser_port_device_realize(DeviceState *= dev, Error **errp) > return; > } > =20 > - if (find_port_by_name(port->name)) { > + if (port->name !=3D NULL && find_port_by_name(port->name)) { > error_setg(errp, "virtio-serial-bus: A port already exists by na= me %s", > port->name); > return; > --=20 > 1.9.3 >=20 Reviewed-by: Amos Kong --=20 Amos. --veXX9dWIonWZEC6h Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJUWwxdAAoJELxSv6I5vP9jXZYP/0fvk8fY/MT0zejsAXTolUiQ 2i3mN/G3CzyVp63dnhi7x0DdAV9Kp2zgIr1ldSRuJ5NFrjbyKpMivaKTE5PmTjfA EIPRAvLhfUsZQEEGA+TjcontJeFMOJtiNd5MAhdXlcfm49xIwMeJAwFq4Mx2bt3x T08S1FZbFy9kYhajQtYSIN3iF2Z8i00sFPRZagWxjKUBGahIvZZsCBomYOYyVurE ELxHQeCZfubUvBpJRylF2vF4zVnesFAuoneg4O2gWsTkHxmb9O8FxrsPWl9Td08D MP7B3eUSy7qZgXwhiAyg2xwlsctIJLEZznu+n3JAHZ5aqw84099DI6g2a7BN9BG2 FBfJIxvdT22VoTHw+nKftPzo/FDY3NlPvuZGvqeiTFuurYVn6EzYEDEr896gcglI z7qgfNEUATMyXNCldRj/O2vh18fCQnpyatMWZ7zgtUfil7KCO8VAf3Gur3/R9ase xbnA/WTRk25quteK8FzU5z1j6w1e+LnMblCGuVJt8PrFr/x7vpBEA0n3fQjrMYTd qGfeB/4cbxy8eOGkKIwAGO4P6R1anEj1idi3HG9qvLdkCeXfeZpC9yb7khE+CKUe weNVdvguuYfwwLF+d46BH6U5wRwdN4Kc7MzVo7YTdaV62cNVDfzZvnqEtovTGN5i NucQqpaoSvkvvGAaKFmH =GNYz -----END PGP SIGNATURE----- --veXX9dWIonWZEC6h--