From patchwork Thu Oct 25 12:27:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alon Levy X-Patchwork-Id: 194131 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 456972C009B for ; Thu, 25 Oct 2012 23:27:49 +1100 (EST) Received: from localhost ([::1]:45461 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TRMXK-00017V-Qj for incoming@patchwork.ozlabs.org; Thu, 25 Oct 2012 08:27:46 -0400 Received: from eggs.gnu.org ([208.118.235.92]:56441) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TRMX9-00016t-D3 for qemu-devel@nongnu.org; Thu, 25 Oct 2012 08:27:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TRMX8-0003HZ-57 for qemu-devel@nongnu.org; Thu, 25 Oct 2012 08:27:35 -0400 Received: from mx1.redhat.com ([209.132.183.28]:6352) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TRMX7-0003HN-Sv for qemu-devel@nongnu.org; Thu, 25 Oct 2012 08:27:34 -0400 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id q9PCRW0U022007 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Thu, 25 Oct 2012 08:27:32 -0400 Received: from garlic.tlv.redhat.com (spice-ovirt.tlv.redhat.com [10.35.4.71]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id q9PCRTkI014706; Thu, 25 Oct 2012 08:27:30 -0400 From: Alon Levy To: qemu-devel@nongnu.org, kraxel@redhat.com Date: Thu, 25 Oct 2012 14:27:28 +0200 Message-Id: <1351168048-29190-1-git-send-email-alevy@redhat.com> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.12 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] hw/qxl: vaildate surface->data 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 | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/hw/qxl.c b/hw/qxl.c index 1b47ed3..620b476 100644 --- a/hw/qxl.c +++ b/hw/qxl.c @@ -453,6 +453,16 @@ static int qxl_track_command(PCIQXLDevice *qxl, struct QXLCommandExt *ext) cmd->u.surface_create.stride); return 1; } + if (cmd->type == QXL_SURFACE_CMD_CREATE) { + intptr_t surface_offset = (intptr_t)qxl_phys2virt(qxl, + cmd->u.surface_create.data, + MEMSLOT_GROUP_GUEST); + if (!surface_offset) { + qxl_set_guest_bug(qxl, "QXL_CMD_SURFACE invalid data: %ld\n", + cmd->u.surface_create.data); + return 1; + } + } qemu_mutex_lock(&qxl->track_lock); if (cmd->type == QXL_SURFACE_CMD_CREATE) { qxl->guest_surfaces.cmds[id] = ext->cmd.data;