* [Qemu-devel] [PATCHv2] virtio-serial: avoid crash when port has no name
@ 2014-11-05 14:43 Marc-André Lureau
2014-11-06 5:51 ` Amos Kong
0 siblings, 1 reply; 2+ messages in thread
From: Marc-André Lureau @ 2014-11-05 14:43 UTC (permalink / raw)
To: qemu-devel; +Cc: amit.shah, Marc-André Lureau
It seems "name" is not mandatory, and the following command line (based
on one generated by current libvirt) will crash qemu at start:
qemu-system-x86_64 \
-device virtio-serial-pci \
-device virtserialport,name=foo \
-device virtconsole
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=0x0) at /home/elmarco/src/qemu/hw/char/virtio-serial-bus.c:67
Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
---
hw/char/virtio-serial-bus.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
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;
}
- if (find_port_by_name(port->name)) {
+ if (port->name != NULL && find_port_by_name(port->name)) {
error_setg(errp, "virtio-serial-bus: A port already exists by name %s",
port->name);
return;
--
1.9.3
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Qemu-devel] [PATCHv2] virtio-serial: avoid crash when port has no name
2014-11-05 14:43 [Qemu-devel] [PATCHv2] virtio-serial: avoid crash when port has no name Marc-André Lureau
@ 2014-11-06 5:51 ` Amos Kong
0 siblings, 0 replies; 2+ messages in thread
From: Amos Kong @ 2014-11-06 5:51 UTC (permalink / raw)
To: Marc-André Lureau; +Cc: amit.shah, qemu-devel
[-- Attachment #1: Type: text/plain, Size: 1586 bytes --]
On Wed, Nov 05, 2014 at 03:43:14PM +0100, Marc-André 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:
>
> qemu-system-x86_64 \
> -device virtio-serial-pci \
> -device virtserialport,name=foo \
> -device virtconsole
>
> 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=0x0) at /home/elmarco/src/qemu/hw/char/virtio-serial-bus.c:67
>
> Signed-off-by: Marc-André Lureau <marcandre.lureau@gmail.com>
> ---
> hw/char/virtio-serial-bus.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> 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;
> }
>
> - if (find_port_by_name(port->name)) {
> + if (port->name != NULL && find_port_by_name(port->name)) {
> error_setg(errp, "virtio-serial-bus: A port already exists by name %s",
> port->name);
> return;
> --
> 1.9.3
>
Reviewed-by: Amos Kong <akong@redhat.com>
--
Amos.
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2014-11-06 5:51 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-05 14:43 [Qemu-devel] [PATCHv2] virtio-serial: avoid crash when port has no name Marc-André Lureau
2014-11-06 5:51 ` Amos Kong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).