Received: by 2002:a25:f815:0:0:0:0:0 with SMTP id u21csp1492553ybd; Wed, 26 Jun 2019 19:07:19 -0700 (PDT) X-Google-Smtp-Source: APXvYqz5Dy4999I5gbZrR0kU6Ze4VABtJ5TULRSuughICVuWxoWDAoU/cd2TJIPTBqZgLp2tX38+ X-Received: by 2002:a17:90a:778c:: with SMTP id v12mr2599188pjk.141.1561601238969; Wed, 26 Jun 2019 19:07:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1561601238; cv=none; d=google.com; s=arc-20160816; b=e5MLRQGfzloRGwjlu4jIhMfvKIW+6ZzhFKKZpNCP7Y0w1hYr6kofltcRi1PrxVkxVv ADWWQiELY9+E1AQT2yQyZZN2IwezLPkNZxscEeu1+GlEb/Wmu7w66p8XQE2/6A6g8p2D XCT8SvZHvqs+u0LugSAYdXx24GevyPkTfpOAlVcBvj8WgGmbuIc3ojMrDUL+KdLIjQE8 wShbTtyFGSfv82OOm3HOyiI9xm6A8E1RNoUpc8x4JyDwOtORCS5AotvbrymRQHR0jsrC UVQ19Cj3NGefPHqCxr0/cFRUNmqW+VG6SxAxPLU/iWDXjhtCU/YX7YN7Mia+CP0exfBq qXPg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=82kDnNtiY3AITIdg5JH/jSZhryGiuSfbe8vCyOkjj6I=; b=kBPaAiwxq0JuOZtc0QChji/UFjkiwRaiwfhDi85rB0rRcU4A5Nb2r8zv8tavJP8m8P L7wZbkipfwNsxxqM4h4fjmTrOtUL8S6ZSz2brzF24gHR0h4ZIJsz/rT+In023c6O7aVo toWI5hlOpmsAK33m2hMfG3q1ZySPjH1BUbIUYdG6tCDVwXqsfwzFFqhrL6mRlU5G9JW2 6YLohPPygrkPJXEAmINcNxj1RjOmVJzsC6/liOObtCoFFYnHnNb00KStVUIHJjrKcZas j+xZkj+FwXst2EUBpg2oDqN/28VTBsfSTYdoYt4fzzb+UPsrWdxDNrPw+d9QZ3XOwTRN ihdw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@onstation.org header.s=default header.b=apeq8g6o; 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 u18si835912plq.311.2019.06.26.19.06.38; Wed, 26 Jun 2019 19:07:18 -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 (test mode) header.i=@onstation.org header.s=default header.b=apeq8g6o; 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 S1727011AbfF0CFc (ORCPT + 99 others); Wed, 26 Jun 2019 22:05:32 -0400 Received: from onstation.org ([52.200.56.107]:51848 "EHLO onstation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726728AbfF0CFc (ORCPT ); Wed, 26 Jun 2019 22:05:32 -0400 Received: from localhost.localdomain (c-98-239-145-235.hsd1.wv.comcast.net [98.239.145.235]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: masneyb) by onstation.org (Postfix) with ESMTPSA id 1A7CE3E898; Thu, 27 Jun 2019 02:05:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=onstation.org; s=default; t=1561601132; bh=9jlj6K/wCzudyHU/TvWT/fg1kMUL3abjYYgFk/BVctU=; h=From:To:Cc:Subject:Date:From; b=apeq8g6oJvoKBVl5xTxxuA5ZW9+h3DphDig2/d6lpZNPeiSaHjcSWs2i7biL8c9Km AXFFAXosWud+H0IilGshKMmDo5ndoB8BuY2xY3JZTHcbRqNjXvkFiwgtT85FyS5GCj dR3tLcGOStH6czxxnUfb+3fptT7iYlPdeqq9uyMs= From: Brian Masney To: jcrouse@codeaurora.org, robdclark@chromium.org, seanpaul@chromium.org Cc: freedreno@lists.freedesktop.org, jean-philippe.brucker@arm.com, linux-arm-msm@vger.kernel.org, hoegsberg@google.com, dianders@chromium.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, airlied@linux.ie, daniel@ffwll.ch Subject: [PATCH] drm/msm: correct NULL pointer dereference in context_init Date: Wed, 26 Jun 2019 22:05:15 -0400 Message-Id: <20190627020515.5660-1-masneyb@onstation.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Correct attempted NULL pointer dereference in context_init() when running without an IOMMU. Signed-off-by: Brian Masney Fixes: 295b22ae596c ("drm/msm: Pass the MMU domain index in struct msm_file_private") --- The no IOMMU case seems like functionality that we may want to keep based on this comment: https://elixir.bootlin.com/linux/latest/source/drivers/gpu/drm/msm/adreno/a3xx_gpu.c#L523 Once I get the msm8974 interconnect driver done, I'm going to look into what needs to be done to get the IOMMU working on the Nexus 5. Alternatively, for development purposes, maybe we could have a NOOP IOMMU driver that would allow us to remove these NULL checks that are sprinkled throughout the code. I haven't looked into this in detail. Thoughts? drivers/gpu/drm/msm/msm_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c index 451bd4508793..83047cb2c735 100644 --- a/drivers/gpu/drm/msm/msm_drv.c +++ b/drivers/gpu/drm/msm/msm_drv.c @@ -619,7 +619,7 @@ static int context_init(struct drm_device *dev, struct drm_file *file) msm_submitqueue_init(dev, ctx); - ctx->aspace = priv->gpu->aspace; + ctx->aspace = priv->gpu ? priv->gpu->aspace : NULL; file->driver_priv = ctx; return 0; -- 2.20.1