From patchwork Wed Apr 25 09:13:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 154838 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 506E8B6FAA for ; Wed, 25 Apr 2012 19:14:21 +1000 (EST) Received: from localhost ([::1]:55966 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SMyIl-0000Dd-2H for incoming@patchwork.ozlabs.org; Wed, 25 Apr 2012 05:14:19 -0400 Received: from eggs.gnu.org ([208.118.235.92]:44155) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SMyIa-00005t-H8 for qemu-devel@nongnu.org; Wed, 25 Apr 2012 05:14:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SMyIU-0001fO-FB for qemu-devel@nongnu.org; Wed, 25 Apr 2012 05:14:08 -0400 Received: from mx1.redhat.com ([209.132.183.28]:26847) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SMyIU-0001fF-7p for qemu-devel@nongnu.org; Wed, 25 Apr 2012 05:14:02 -0400 Received: from int-mx01.intmail.prod.int.phx2.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q3P9E0oX003867 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 25 Apr 2012 05:14:00 -0400 Received: from garlic.redhat.com (vpn-202-70.tlv.redhat.com [10.35.202.70]) by int-mx01.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q3P9DVQu024620; Wed, 25 Apr 2012 05:13:52 -0400 From: Alon Levy To: qemu-devel@nongnu.org, kraxel@redhat.com Date: Wed, 25 Apr 2012 12:13:19 +0300 Message-Id: <1335345205-8908-3-git-send-email-alevy@redhat.com> In-Reply-To: <1335345205-8908-1-git-send-email-alevy@redhat.com> References: <4F967EEA.6000302@redhat.com> <1335345205-8908-1-git-send-email-alevy@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.11 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.132.183.28 Subject: [Qemu-devel] [PATCH 3/9] qxl: replace panic with guest bug in qxl_track_command 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 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 b6a738e..8b66cbb 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -394,7 +394,11 @@ static int qxl_track_command(PCIQXLDevice *qxl, struct QXLCommandExt *ext) return 1; } uint32_t id = le32_to_cpu(cmd->surface_id); - PANIC_ON(id >= NUM_SURFACES); + + if (id >= NUM_SURFACES) { + qxl_guest_bug(qxl, "QXL_CMD_SURFACE id %d >= %d", id, NUM_SURFACES); + return 1; + } qemu_mutex_lock(&qxl->track_lock); if (cmd->type == QXL_SURFACE_CMD_CREATE) { qxl->guest_surfaces.cmds[id] = ext->cmd.data;