From patchwork Tue Nov 19 18:26:42 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Don Koch X-Patchwork-Id: 292530 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id E53502C016A for ; Wed, 20 Nov 2013 05:27:23 +1100 (EST) Received: from localhost ([::1]:51066 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Viq1B-0003Qi-Bd for incoming@patchwork.ozlabs.org; Tue, 19 Nov 2013 13:27:21 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38365) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Viq0k-0003Ia-Ge for qemu-devel@nongnu.org; Tue, 19 Nov 2013 13:27:00 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Viq0e-0004is-Fc for qemu-devel@nongnu.org; Tue, 19 Nov 2013 13:26:54 -0500 Received: from omzsmtpe02.verizonbusiness.com ([199.249.25.209]:46448) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Viq0e-0004ig-92 for qemu-devel@nongnu.org; Tue, 19 Nov 2013 13:26:48 -0500 X-IronPort-Anti-Spam-Filtered: false Received: from omzsmtpi03.vzbi.com ([165.122.46.173]) by omzsmtpe02.verizonbusiness.com with ESMTP; 19 Nov 2013 18:26:45 +0000 From: Don Koch X-IronPort-AV: E=Sophos;i="4.93,730,1378857600"; d="scan'208";a="223194456" Received: from unknown (HELO MIA20725CAS892.apps.tmrk.corp) ([162.47.0.51]) by omzsmtpi03.vzbi.com with ESMTP; 19 Nov 2013 18:26:43 +0000 Received: from yoyo.cloudswitch.com (10.25.25.113) by MIA20725CAS892.apps.tmrk.corp (10.1.3.224) with Microsoft SMTP Server (TLS) id 14.2.318.1; Tue, 19 Nov 2013 13:26:43 -0500 Message-ID: <528BAD62.8090103@terremark.com> Date: Tue, 19 Nov 2013 13:26:42 -0500 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130805 Thunderbird/17.0.8 MIME-Version: 1.0 To: qemu-devel , Anthony Liguori X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 199.249.25.209 Subject: [Qemu-devel] [PATCH] Don't crash on keyboard input with no handler 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 Prevent a call to put_kbd if null. On shutdown of some OSes, the keyboard handler goes away before the system is down. If a key is typed during this window, qemu crashes. Signed-off-by: Don Koch --- I left the printf call, originally for testing, but useful as a sanity check if the user wonders why his keyboard input was ignored. AFAIC, it can be removed. PS: Anthony, your address in the MAINTAINER file is still at ibm. I assume that is no longer correct, yes? ui/input.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 1.8.1.4 diff --git a/ui/input.c b/ui/input.c index 92c44ca..28ef6a6 100644 --- a/ui/input.c +++ b/ui/input.c @@ -415,8 +415,10 @@ void kbd_put_keycode(int keycode) return; } if (entry) { - entry->put_kbd(entry->opaque, keycode); + if (entry->put_kbd) + entry->put_kbd(entry->opaque, keycode); + else + printf("%s: no keyboard handler\n", __FUNCTION__); } } --