From patchwork Thu Jan 12 17:35:25 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Graf X-Patchwork-Id: 135657 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 976F6B6EF2 for ; Fri, 13 Jan 2012 04:36:16 +1100 (EST) Received: from localhost ([::1]:44131 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlOZP-0003pG-Ks for incoming@patchwork.ozlabs.org; Thu, 12 Jan 2012 12:36:11 -0500 Received: from eggs.gnu.org ([140.186.70.92]:54025) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlOYz-0003OR-GY for qemu-devel@nongnu.org; Thu, 12 Jan 2012 12:35:52 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1RlOYs-0003gz-ST for qemu-devel@nongnu.org; Thu, 12 Jan 2012 12:35:45 -0500 Received: from cantor2.suse.de ([195.135.220.15]:43289 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RlOYs-0003fg-KH; Thu, 12 Jan 2012 12:35:38 -0500 Received: from relay1.suse.de (unknown [195.135.220.254]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id C89B68BB22; Thu, 12 Jan 2012 18:35:32 +0100 (CET) From: Alexander Graf To: qemu-devel Developers Date: Thu, 12 Jan 2012 18:35:25 +0100 Message-Id: <1326389731-1694-2-git-send-email-agraf@suse.de> X-Mailer: git-send-email 1.7.3.4 In-Reply-To: <1326389731-1694-1-git-send-email-agraf@suse.de> References: <1326389731-1694-1-git-send-email-agraf@suse.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4-2.6 X-Received-From: 195.135.220.15 Cc: jmforbes@linuxtx.org, qemu-stable@nongnu.org Subject: [Qemu-devel] [PATCH 1/7] console: Fix segfault on screendump without VGA adapter X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org When trying to create a screen dump without having any VGA adapter inside the guest, QEMU segfaults. This is because it's trying to switch back to the "previous" screen it was on before dumping the VGA screen. Unfortunately, in my case there simply is no previous screen so it accesses a NULL pointer. Fix it by checking if previous_active_console is actually available. This is 1.0 material. Signed-off-by: Alexander Graf --- console.c | 4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/console.c b/console.c index f6fe441..ed6a653 100644 --- a/console.c +++ b/console.c @@ -186,7 +186,9 @@ void vga_hw_screen_dump(const char *filename) consoles[0]->hw_screen_dump(consoles[0]->hw, filename); } - console_select(previous_active_console->index); + if (previous_active_console) { + console_select(previous_active_console->index); + } } void vga_hw_text_update(console_ch_t *chardata)