Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3002182ybi; Mon, 17 Jun 2019 14:26:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqwc0HNBWV6rWoEWMEW6nSa+vjaMlk7IMbTR8QoBAtrTsVVkbTIWSZRMiZ8NRlvE2ChZqppe X-Received: by 2002:aa7:9834:: with SMTP id q20mr73801283pfl.196.1560806780069; Mon, 17 Jun 2019 14:26:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560806780; cv=none; d=google.com; s=arc-20160816; b=kErwbWPwl1HpvDRf4qVLthmAMwgLdoUma7Gn28uWvaaTN+l1dTvFvTErYgFAycFsOe m8W6XHX9Nq8Ik91duSiwFTm21a8GRvcZVtyL9YSWNTstedZX/obGpCIUBFx5CGYoFmZ7 /I1mDZQtpukMYelTdY7byGbtsNg+4EzbVFm/MK2swqpFmiZaRtHoefCdVxWlxVOiPDUY q4tUl4t6Ir4mgfZiOGTBeK6qn8a5fEepYsxCzWkgyi6iTaodWfYTUT6WztJGS/+JHLsR stcYoo8aO9wEbiWIRgW2wlDKQdYaVE9Kf7VyBm3CEm6bk42wkq07R34Pi4Cx+r/fVckU sdew== 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=hGEdX7d9apRSA0yP0LmuT4F3Po9MONZfbK7mYAgS0Ow=; b=sjRMFc0gKJFNd8uiC4ERz3hVOlB4xTweYGjMt6Scv+Zgu0sRpqAOUG4l9dpxnnlPS4 UZsZiC5G8r8HEj3jiVH+vwNfXgWqJU9L264iJKqdOsdZ+zfmlqAKpyzH4MH0IzXkxKKy GI1jWu4PAwC/m0vJWHyZrTubE43920pRLzqWj7CO0eKSkOzeSCKUi/ppsKP8YEsOW/tn d48Wzhe8sWCPOBAcHc5rBbgjiHDkWwyQgl7puHbM4CZVRsBU+1BcHFA+MEonMz+S7bes sZjS/nMO8s2sDCWqCEBZnh+jOsNarnYb8MYUu2+RIYFifzrPYatw5OFzp9OB+AqIxB/O KL/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Obw6bWqo; 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 59si11947935plp.90.2019.06.17.14.26.05; Mon, 17 Jun 2019 14:26:20 -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=Obw6bWqo; 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 S1729824AbfFQVX4 (ORCPT + 99 others); Mon, 17 Jun 2019 17:23:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:49268 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729811AbfFQVXz (ORCPT ); Mon, 17 Jun 2019 17:23:55 -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 5A2BC2063F; Mon, 17 Jun 2019 21:23:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1560806634; bh=a60lBc3eWjEp0DIOA9i01WBA7LgySB31ZZMj2SCPxA4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Obw6bWqoxgx8pcCkolZH4RVYmZN4vM5Z2ThOyAgCOFvrMRF6iWpf8VHECpzQXraVp JqDhu4MszfBW0x82xrmyZHOAZYdaovwUg2s821pdncmw6O88tWAIh6qLlf5w5DVZSc W/QKsMBC8o+vtkedGgyjFnso5ljo1G58taa+c8uM= 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 096/115] drm/vmwgfx: NULL pointer dereference from vmw_cmd_dx_view_define() Date: Mon, 17 Jun 2019 23:09:56 +0200 Message-Id: <20190617210804.805905990@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 bcd6aa7b6cbfd6f985f606c6f76046d782905820 upstream. If SVGA_3D_CMD_DX_DEFINE_RENDERTARGET_VIEW is called with a surface ID of SVGA3D_INVALID_ID, the srf struct will remain NULL after vmw_cmd_res_check(), leading to a null pointer dereference in vmw_view_add(). 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 | 4 ++++ 1 file changed, 4 insertions(+) --- a/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_execbuf.c @@ -2588,6 +2588,10 @@ static int vmw_cmd_dx_view_define(struct if (view_type == vmw_view_max) return -EINVAL; cmd = container_of(header, typeof(*cmd), header); + if (unlikely(cmd->sid == SVGA3D_INVALID_ID)) { + DRM_ERROR("Invalid surface id.\n"); + return -EINVAL; + } ret = vmw_cmd_res_check(dev_priv, sw_context, vmw_res_surface, user_surface_converter, &cmd->sid, &srf);