qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Amit Shah <amit.shah@redhat.com>
To: qemu list <qemu-devel@nongnu.org>
Cc: Amit Shah <amit.shah@redhat.com>, Markus Armbruster <armbru@redhat.com>
Subject: [Qemu-devel] [PATCH 1/1] virtio-serial: fix segfault on NULL port names
Date: Wed,  4 Mar 2015 14:33:56 +0530	[thread overview]
Message-ID: <36afc0db03021aa7259dc76107e8f5bb4ae61e10.1425459836.git.amit.shah@redhat.com> (raw)

Commit d0a0bfe6729ef6044d76ea49fafa07e29fa598bd added checks for port
names, but didn't add a check to ensure port->name is non-NULL.  This
results in a SIGSEGV.

https://bugzilla.redhat.com/show_bug.cgi?id=1192775

Reported-by: vivian zhang <vivianzhang@redhat.com>
Signed-off-by: Amit Shah <amit.shah@redhat.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 47fbb34..acd1173 100644
--- a/hw/char/virtio-serial-bus.c
+++ b/hw/char/virtio-serial-bus.c
@@ -64,7 +64,7 @@ static VirtIOSerialPort *find_port_by_name(char *name)
         VirtIOSerialPort *port;
 
         QTAILQ_FOREACH(port, &vser->ports, next) {
-            if (!strcmp(port->name, name)) {
+            if (port->name && !strcmp(port->name, name)) {
                 return port;
             }
         }
-- 
2.1.0

             reply	other threads:[~2015-03-04  9:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-04  9:03 Amit Shah [this message]
2015-03-04 10:49 ` [Qemu-devel] [PATCH 1/1] virtio-serial: fix segfault on NULL port names Markus Armbruster

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=36afc0db03021aa7259dc76107e8f5bb4ae61e10.1425459836.git.amit.shah@redhat.com \
    --to=amit.shah@redhat.com \
    --cc=armbru@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).