From: Stefan Weil <weil@mail.berlios.de>
To: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
Cc: Anthony Liguori <aliguori@us.ibm.com>,
qemu-devel@nongnu.org, Michal Suchanek <hramrach@centrum.cz>,
Gerd Hoffmann <kraxel@redhat.com>
Subject: Re: [Qemu-devel] [PATCH] console: Avoid dereferencing NULL active_console
Date: Thu, 30 Sep 2010 18:55:27 +0200 [thread overview]
Message-ID: <4CA4C0FF.90304@mail.berlios.de> (raw)
In-Reply-To: <1284988279-8900-1-git-send-email-stefanha@linux.vnet.ibm.com>
Am 20.09.2010 15:11, schrieb Stefan Hajnoczi:
> The console_select() function does not check that active_console is
> non-NULL before dereferencing it. When invoked with qemu -nodefaults it
> is possible to hit this case.
>
> This patch checks that active_console is non-NULL before stashing away
> the old console dimensions in console_select().
>
> Signed-off-by: Stefan Hajnoczi <stefanha@linux.vnet.ibm.com>
> ---
> console.c | 6 ++++--
> 1 files changed, 4 insertions(+), 2 deletions(-)
>
> diff --git a/console.c b/console.c
> index 698bc10..c1728b1 100644
> --- a/console.c
> +++ b/console.c
> @@ -1060,8 +1060,10 @@ void console_select(unsigned int index)
>
> if (index >= MAX_CONSOLES)
> return;
> - active_console->g_width = ds_get_width(active_console->ds);
> - active_console->g_height = ds_get_height(active_console->ds);
> + if (active_console) {
> + active_console->g_width = ds_get_width(active_console->ds);
> + active_console->g_height = ds_get_height(active_console->ds);
> + }
> s = consoles[index];
> if (s) {
> DisplayState *ds = s->ds;
To avoid that still more people fix the same bug,
I'd appreciate shorter commit times for simple patches like this one.
Cheers,
Stefan
Acked-by: Stefan Weil <weil@mail.berlios.de>
next prev parent reply other threads:[~2010-09-30 16:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-20 13:11 [Qemu-devel] [PATCH] console: Avoid dereferencing NULL active_console Stefan Hajnoczi
2010-09-29 8:44 ` [Qemu-devel] " Gerd Hoffmann
2010-09-30 16:55 ` Stefan Weil [this message]
2010-10-03 7:52 ` [Qemu-devel] " Blue Swirl
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=4CA4C0FF.90304@mail.berlios.de \
--to=weil@mail.berlios.de \
--cc=aliguori@us.ibm.com \
--cc=hramrach@centrum.cz \
--cc=kraxel@redhat.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).