From patchwork Wed Jan 27 20:01:17 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luiz Capitulino X-Patchwork-Id: 43832 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id BF451B7CEC for ; Thu, 28 Jan 2010 07:03:16 +1100 (EST) Received: from localhost ([127.0.0.1]:38941 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NaE6L-0007LN-SX for incoming@patchwork.ozlabs.org; Wed, 27 Jan 2010 15:02:57 -0500 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NaE4w-0007Jj-T2 for qemu-devel@nongnu.org; Wed, 27 Jan 2010 15:01:30 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NaE4s-0007G7-Jr for qemu-devel@nongnu.org; Wed, 27 Jan 2010 15:01:30 -0500 Received: from [199.232.76.173] (port=41117 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NaE4s-0007Fs-EC for qemu-devel@nongnu.org; Wed, 27 Jan 2010 15:01:26 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57063) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NaE4r-0002IH-Pj for qemu-devel@nongnu.org; Wed, 27 Jan 2010 15:01:26 -0500 Received: from int-mx03.intmail.prod.int.phx2.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o0RK1Nwd026128 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Wed, 27 Jan 2010 15:01:23 -0500 Received: from doriath (vpn-8-160.rdu.redhat.com [10.11.8.160]) by int-mx03.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o0RK1Km4028430 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NO); Wed, 27 Jan 2010 15:01:22 -0500 Date: Wed, 27 Jan 2010 18:01:17 -0200 From: Luiz Capitulino To: qemu-devel@nongnu.org Message-ID: <20100127180117.5cf438bf@doriath> Organization: Red Hat Mime-Version: 1.0 X-Scanned-By: MIMEDefang 2.67 on 10.5.11.16 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Cc: agl@us.ibm.com Subject: [Qemu-devel] [PATCH] Monitor: Fix command execution regression X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Function is_async_return() added by commit 940cc30d0d4 assumes that 'data', which is returned by handlers, is always a QDict. This is not true, as QLists can also be returned, in this case we'll get a segfault. Fix that by checking if 'data' is a QDict. Signed-off-by: Luiz Capitulino --- monitor.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/monitor.c b/monitor.c index fbae5ce..fb7c572 100644 --- a/monitor.c +++ b/monitor.c @@ -3700,7 +3700,11 @@ static void monitor_print_error(Monitor *mon) static int is_async_return(const QObject *data) { - return data && qdict_haskey(qobject_to_qdict(data), "__mon_async"); + if (data && qobject_type(data) == QTYPE_QDICT) { + return qdict_haskey(qobject_to_qdict(data), "__mon_async"); + } + + return 0; } static void monitor_call_handler(Monitor *mon, const mon_cmd_t *cmd,