From: Aurelien Jarno <aurelien@aurel32.net>
To: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>, qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] qemu-char: Check for missing backend name
Date: Sun, 20 Feb 2011 18:27:37 +0100 [thread overview]
Message-ID: <20110220172737.GO18619@volta.aurel32.net> (raw)
In-Reply-To: <1295701646-3022-1-git-send-email-stefanha@linux.vnet.ibm.com>
On Sat, Jan 22, 2011 at 01:07:26PM +0000, Stefan Hajnoczi wrote:
> Check if the backend option is missing before searching the backend
> table. This fixes a NULL pointer dereference when QEMU is invoked with
> the following invalid command-line:
>
> $ qemu -chardev id=foo,path=/tmp/socket
>
> Previously QEMU would segfault, now it produces this error message:
>
> chardev: "foo" missing backend
>
> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
> ---
> qemu-char.c | 5 +++++
> 1 files changed, 5 insertions(+), 0 deletions(-)
Thanks, applied.
> diff --git a/qemu-char.c b/qemu-char.c
> index edc9ad6..8a424d6 100644
> --- a/qemu-char.c
> +++ b/qemu-char.c
> @@ -2508,6 +2508,11 @@ CharDriverState *qemu_chr_open_opts(QemuOpts *opts,
> return NULL;
> }
>
> + if (qemu_opt_get(opts, "backend") == NULL) {
> + fprintf(stderr, "chardev: \"%s\" missing backend\n",
> + qemu_opts_id(opts));
> + return NULL;
> + }
> for (i = 0; i < ARRAY_SIZE(backend_table); i++) {
> if (strcmp(backend_table[i].name, qemu_opt_get(opts, "backend")) == 0)
> break;
> --
> 1.7.2.3
>
>
>
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
prev parent reply other threads:[~2011-02-20 17:27 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-22 13:07 [Qemu-devel] [PATCH] qemu-char: Check for missing backend name Stefan Hajnoczi
2011-02-20 17:27 ` Aurelien Jarno [this message]
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=20110220172737.GO18619@volta.aurel32.net \
--to=aurelien@aurel32.net \
--cc=aliguori@us.ibm.com \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@linux.vnet.ibm.com \
/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).