From nobody Sun Feb 8 21:48:54 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1649156148; cv=none; d=zohomail.com; s=zohoarc; b=S3UjJBTesBPf6SnY9fMaC6IFN6cKS2KquxJyPOmAerJ8tPrF02TtkTUvgtPM7z3zgaQHDU6o0eUmvj9QdNQ3DXUob07IyKqq+pqM+T5hPrDsz5QwM0mMRoGTw5I3xjIV8J848CnukO4YOp0WQFhs40s8Uw1UcyWigGswCfE2ib4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1649156148; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=47ewJs8quyFFhN+9svZIjCXIKOn2Q5HE6bg6HKFg+RA=; b=kAZFuulesxniFRlTBaaVLaxYPRd9ydzj2CPmUpSAsfB2JnzjXavSfzPA6m5uTIwEMHXgGhgvRSv2VdN2km/9kL/Ay6vUZZFEz9rlhpEx886Bk39/CD+XObBeLPFHcTH/JIC8yxhAsrnBpRtuFfTiM5eihFr2fndC4o3fp9pTtbE= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1649156148070830.915127101721; Tue, 5 Apr 2022 03:55:48 -0700 (PDT) Received: from localhost ([::1]:45238 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nbgqg-0001Ta-OK for importer@patchew.org; Tue, 05 Apr 2022 06:55:46 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60440) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nbgWx-00024P-EE for qemu-devel@nongnu.org; Tue, 05 Apr 2022 06:35:24 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:46480) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nbgWq-0000Eq-97 for qemu-devel@nongnu.org; Tue, 05 Apr 2022 06:35:19 -0400 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-584-ys5hNhMOMsmEujqgj_6-iw-1; Tue, 05 Apr 2022 06:35:10 -0400 Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.rdu2.redhat.com [10.11.54.7]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 03EF485A5BC for ; Tue, 5 Apr 2022 10:35:10 +0000 (UTC) Received: from f35-work.redhat.com (unknown [10.39.194.3]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 3BC981415125; Tue, 5 Apr 2022 10:35:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1649154911; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=47ewJs8quyFFhN+9svZIjCXIKOn2Q5HE6bg6HKFg+RA=; b=cRPMSITs8A3DJXacLV7IkWk9AFl2GWFO8HQi+qSw7UpU5nEoz2JidG3iCefx8UnLJod6Ej 8tElC6/BpOOnl8f4Cfzgsy5Nb4Hsd9MHlRPOCZStBy+lCXTb2m2wz3V9Q2QQILVMi8+JME YIGZYyrg0t3FQRYqk5fdFpXEfJ5CDQ4= X-MC-Unique: ys5hNhMOMsmEujqgj_6-iw-1 From: Mauro Matteo Cascella To: qemu-devel@nongnu.org Subject: [PATCH] display/qxl-render: fix race condition in qxl_cursor (CVE-2022-4207) Date: Tue, 5 Apr 2022 12:35:05 +0200 Message-Id: <20220405103505.106034-1-mcascell@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.7 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=mcascell@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=170.10.133.124; envelope-from=mcascell@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: -28 X-Spam_score: -2.9 X-Spam_bar: -- X-Spam_report: (-2.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.082, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H5=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: mcascell@redhat.com, kraxel@redhat.com Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: pass (identity @redhat.com) X-ZM-MESSAGEID: 1649156149307100001 Content-Type: text/plain; charset="utf-8"; x-default="true" Avoid fetching 'width' and 'height' a second time to prevent possible race condition. Refer to security advisory https://starlabs.sg/advisories/22-4207/ for more information. Fixes: CVE-2022-4207 Signed-off-by: Mauro Matteo Cascella Reviewed-by: Gerd Hoffmann Reviewed-by: Marc-Andr=C3=A9 Lureau --- hw/display/qxl-render.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/display/qxl-render.c b/hw/display/qxl-render.c index d28849b121..237ed293ba 100644 --- a/hw/display/qxl-render.c +++ b/hw/display/qxl-render.c @@ -266,7 +266,7 @@ static QEMUCursor *qxl_cursor(PCIQXLDevice *qxl, QXLCur= sor *cursor, } break; case SPICE_CURSOR_TYPE_ALPHA: - size =3D sizeof(uint32_t) * cursor->header.width * cursor->header.= height; + size =3D sizeof(uint32_t) * c->width * c->height; qxl_unpack_chunks(c->data, size, qxl, &cursor->chunk, group_id); if (qxl->debug > 2) { cursor_print_ascii_art(c, "qxl/alpha"); --=20 2.35.1