Patchwork check for active_console before using it

login
register
mail settings
Submitter Gerd Hoffmann
Date May 20, 2010, 1:23 p.m.
Message ID <1274361786-4898-1-git-send-email-kraxel@redhat.com>
Download mbox | patch
Permalink /patch/53071/
State New
Headers show

Comments

Gerd Hoffmann - May 20, 2010, 1:23 p.m.
Other vga_hw_* functions do the same.
Fixes a segmentation fault.  Trigger: boot with -nodefaults,
then connect via vnc.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 console.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
Anthony Liguori - June 1, 2010, 6:28 p.m.
On 05/20/2010 08:23 AM, Gerd Hoffmann wrote:
> Other vga_hw_* functions do the same.
> Fixes a segmentation fault.  Trigger: boot with -nodefaults,
> then connect via vnc.
>
> Signed-off-by: Gerd Hoffmann<kraxel@redhat.com>
>    

Applied.  Thanks.

Regards,

Anthony Liguori
> ---
>   console.c |    2 +-
>   1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/console.c b/console.c
> index 7070b1b..4c42b28 100644
> --- a/console.c
> +++ b/console.c
> @@ -167,7 +167,7 @@ void vga_hw_update(void)
>
>   void vga_hw_invalidate(void)
>   {
> -    if (active_console->hw_invalidate)
> +    if (active_console&&  active_console->hw_invalidate)
>           active_console->hw_invalidate(active_console->hw);
>   }
>
>

Patch

diff --git a/console.c b/console.c
index 7070b1b..4c42b28 100644
--- a/console.c
+++ b/console.c
@@ -167,7 +167,7 @@  void vga_hw_update(void)
 
 void vga_hw_invalidate(void)
 {
-    if (active_console->hw_invalidate)
+    if (active_console && active_console->hw_invalidate)
         active_console->hw_invalidate(active_console->hw);
 }