From patchwork Wed Oct 3 18:13:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 188874 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id CE7B72C00FA for ; Thu, 4 Oct 2012 04:14:15 +1000 (EST) Received: from localhost ([::1]:36310 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJTSW-00020P-57 for incoming@patchwork.ozlabs.org; Wed, 03 Oct 2012 14:14:12 -0400 Received: from eggs.gnu.org ([208.118.235.92]:37828) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJTSN-0001zs-4N for qemu-devel@nongnu.org; Wed, 03 Oct 2012 14:14:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TJTSM-0008Gw-3n for qemu-devel@nongnu.org; Wed, 03 Oct 2012 14:14:03 -0400 Received: from mx1.redhat.com ([209.132.183.28]:56519) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TJTSL-0008Gq-SW for qemu-devel@nongnu.org; Wed, 03 Oct 2012 14:14:02 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q93IE0E8009672 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 3 Oct 2012 14:14:00 -0400 Received: from garlic.redhat.com (vpn1-5-196.ams2.redhat.com [10.36.5.196]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id q93IDx5d001065; Wed, 3 Oct 2012 14:13:59 -0400 From: Alon Levy To: qemu-devel@nongnu.org Date: Wed, 3 Oct 2012 20:13:58 +0200 Message-Id: <1349288038-15890-1-git-send-email-alevy@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Cc: kraxel@redhat.com Subject: [Qemu-devel] [PATCH] hw/qxl: exit on failure to register qxl interface 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 This prevents a segfault later on when the device reset handler tries to access a NULL ssd.worker since interface_attach_worker has not been called. Signed-off-by: Alon Levy --- hw/qxl.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/hw/qxl.c b/hw/qxl.c index 58c4643..4effb66 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -2044,7 +2044,11 @@ static int qxl_init_common(PCIQXLDevice *qxl) qxl->ssd.qxl.base.sif = &qxl_interface.base; qxl->ssd.qxl.id = qxl->id; - qemu_spice_add_interface(&qxl->ssd.qxl.base); + if (qemu_spice_add_interface(&qxl->ssd.qxl.base) != 0) { + error_report("qxl interface %d.%d not supported by spice-server\n", + SPICE_INTERFACE_QXL_MAJOR, SPICE_INTERFACE_QXL_MINOR); + return -1; + } qemu_add_vm_change_state_handler(qxl_vm_change_state_handler, qxl); init_pipe_signaling(qxl);