Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3002127ybi; Mon, 17 Jun 2019 14:26:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqy69SkPGFgr4zD0lTjZK9nsr+0+rgILOQ2jSDMQNhvJptI7bVgxC6jyiA9IrQfJvDuH3SFG X-Received: by 2002:a17:90a:346c:: with SMTP id o99mr1178681pjb.20.1560806775908; Mon, 17 Jun 2019 14:26:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560806775; cv=none; d=google.com; s=arc-20160816; b=RJs8W3I1LCBz4GuKrOH4D/WIQuovH7byteGKxeFMhTYRtcun1eQrfIGNzWF7TUgZZy 2xikNxm9EDS5gthjFqwmQiodAeHd9B0ob1WtZJye3ZScv/MD+HSKD1ggFo8FQLzUIZsu mq5T/gKI2NbTEdWJmTDOc/mlUsmxSevJnlSyMTdtCsHvdVSZvcfE/0gXTW/Vy2amfNNb 2tnZZsveZW6G4hUQiKxewbvDuIKbT5ljbob470MveiEpmELZii3zEtoQixZ17URQ0688 dFFNA0jhu2wSx+eeyJmZEOob67aObRB/VxYfByubcyXJ1pYy3jG8Le7FCLtKjx7Ltb+R zYQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=QRigLZvPxQL27mfonngeEse2zLJZbGWYmXigc9hWF+0=; b=XvJAoGF3V/uxTNFicPKhi6Cg7eBmoUyvSObXGaCOEXMJ9G19HQzELhNRIK/ddctx+K wXYtu3lYEr8A/wIIRNp7rn98XFIWRlKG1AvhcgjyAg39PdbSaMu55IBzn24iBVLwSMD/ 9y4+P8zru6a+ll/0n7osQlAp3ATDJNhzDBrA1oKKlvx904MruTUHKVoVcQ5v3s4O78Wv huvA/6dqGNge8Q1NJp1D9AHNseY1HXr7HA2OYpWtv1hpGEN58bEVOtKu41zWXgwIoMSc 73H6qRdM1KOItPYaB8BU5bRXzs9wcEOPlYqfNJQ5D1r/vfmi68Xhf4JjZuKWjMGrRC9U PCkA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Lj+pPv/g"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z21si4546278pgi.335.2019.06.17.14.26.00; Mon, 17 Jun 2019 14:26:15 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b="Lj+pPv/g"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729813AbfFQVX4 (ORCPT + 99 others); Mon, 17 Jun 2019 17:23:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:49206 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729805AbfFQVXw (ORCPT ); Mon, 17 Jun 2019 17:23:52 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A188120861; Mon, 17 Jun 2019 21:23:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560806632; bh=Opv/mSurQ8nj6sHht/tUxAYzrYb+iP1/XHfMYCvjMQU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Lj+pPv/gLGlckLr6KddC8qEpQV9U1FPhHbSor+QUmflQlgbL7cdHZsWYVdW/L8SDz FOw1tz+3iYE9zUMopMI5cNBiDiK9wNOyKCws7tlnDBYyb/ugdMY1AfmWVTBJ6wZpzV A3JnRyWN7KKFaIlvtghsMvKBh2mHHY+O06Cljx6s= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Murray McAllister , Thomas Hellstrom Subject: [PATCH 5.1 095/115] drm/vmwgfx: integer underflow in vmw_cmd_dx_set_shader() leading to an invalid read Date: Mon, 17 Jun 2019 23:09:55 +0200 Message-Id: <20190617210804.767858738@linuxfoundation.org> X-Mailer: git-send-email 2.22.0 In-Reply-To: <20190617210759.929316339@linuxfoundation.org> References: <20190617210759.929316339@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Murray McAllister commit 5ed7f4b5eca11c3c69e7c8b53e4321812bc1ee1e upstream. If SVGA_3D_CMD_DX_SET_SHADER is called with a shader ID of SVGA3D_INVALID_ID, and a shader type of SVGA3D_SHADERTYPE_INVALID, the calculated binding.shader_slot will be 4294967295, leading to an out-of-bounds read in vmw_binding_loc() when the offset is calculated. Cc: Fixes: d80efd5cb3de ("drm/vmwgfx: Initial DX support") Signed-off-by: Murray McAllister Reviewed-by: Thomas Hellstrom Signed-off-by: Thomas Hellstrom Signed-off-by: Greg Kroah-Hartman --- drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c @@ -2351,7 +2351,8 @@ static int vmw_cmd_dx_set_shader(struct cmd = container_of(header, typeof(*cmd), header); - if (cmd->body.type >= SVGA3D_SHADERTYPE_DX10_MAX) { + if (cmd->body.type >= SVGA3D_SHADERTYPE_DX10_MAX || + cmd->body.type < SVGA3D_SHADERTYPE_MIN) { DRM_ERROR("Illegal shader type %u.\n", (unsigned) cmd->body.type); return -EINVAL;