Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp1943886ybv; Fri, 14 Feb 2020 08:38:15 -0800 (PST) X-Google-Smtp-Source: APXvYqxCJMf3MQ8sH+JM0BneFW2nxCKgYD0UMhhXokPhM/gjcuuK+9v2yCFPPYYbP5KozFXn8MU5 X-Received: by 2002:a05:6830:1d93:: with SMTP id y19mr3053384oti.350.1581698295576; Fri, 14 Feb 2020 08:38:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581698295; cv=none; d=google.com; s=arc-20160816; b=iGU9puM+MOdy2wS61kn8pSNDkBM7zbIvXSd74QGloJa+C8HkNeKKLcRHDOVAPF8TWs HeV5u8Ibgw1UrR7111BjA8GTu5gAAnhGiaEdEeSKt//nR5WZVkpP//7FnU1wu1TPFKrJ TriW3Vll9KchwI8gJr3WllN8z0wdkDY31Fq5Fg02HhAbjPH4iDUJhF3wRlQrHEuBRbgR x5YpbPhAow6xAZYMZ1C70KdLH3w04QX7f6iKJMf2+7lfezjit8Oshac6CjOQ/iNujgRP huuiMlRnS6GfQ5YQX1bRTvq25esZyom4lioszAteLVkxdZW+mN6XKyFfDW5mf+nPYWOx N/Kw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=chPg84BMtsj4k50NCPNLkSLq1GzoQqwnq6dTKhrl/Yg=; b=HenubLigN5LaCwVTOEhA4bSHBBJYC/QByzBz3ebE6lz0/pO25UXtxyjbKyIvXpJB5x oKdOBBkXxmP15bOYgPBa5Ayj80jGxsX0nGXYpdaP4PAnoflzSfHVqdM8zhNo5jrgu+Zf LdbH60aq1CQTqBywQKmQuqIB1e67VpZ6D8smkgWSkt7xIGQaERglCi9fdjsARRnvCL2Q sD91ZJVh59hEhLY1ZugoFY/WpgQsY5WmY7ZfhBxsLGgDt0HRH31jag/IVuAGqq4lvWd2 FPJKutQYcmhOLkzIReudCerxMoAlJTPArI8XPdPqx0750sQo8ULJYP4q6mVqBy065hvd jsiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bQswy2mp; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a9si2898580oib.59.2020.02.14.08.38.03; Fri, 14 Feb 2020 08:38:15 -0800 (PST) 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=bQswy2mp; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393749AbgBNQhA (ORCPT + 99 others); Fri, 14 Feb 2020 11:37:00 -0500 Received: from mail.kernel.org ([198.145.29.99]:60610 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2405448AbgBNQYC (ORCPT ); Fri, 14 Feb 2020 11:24:02 -0500 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id E9A282477E; Fri, 14 Feb 2020 16:24:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581697441; bh=ky36aMu0AdjOm6TKsHBpxgM+ZwKEDz8HePbBtRxnoUA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bQswy2mphfDPdD6IUvgSDC8V3hg7xUiT4wW0FTtpgsSU/kg5NLvPkxY8ZyDHLSzUw As1QYYRgTAxbljO0CS8sphS1/mk519PZdDdfYrcHwqDy3IcGZX6cIp5ZkmUyYW7YDv rf69DFCcKUz2urIXNaeUHBfCxp3KF3pEHolcpZYw= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ben Skeggs , Sasha Levin , dri-devel@lists.freedesktop.org, nouveau@lists.freedesktop.org Subject: [PATCH AUTOSEL 4.9 127/141] drm/nouveau/disp/nv50-: prevent oops when no channel method map provided Date: Fri, 14 Feb 2020 11:21:07 -0500 Message-Id: <20200214162122.19794-127-sashal@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200214162122.19794-1-sashal@kernel.org> References: <20200214162122.19794-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ben Skeggs [ Upstream commit 0e6176c6d286316e9431b4f695940cfac4ffe6c2 ] The implementations for most channel types contains a map of methods to priv registers in order to provide debugging info when a disp exception has been raised. This info is missing from the implementation of PIO channels as they're rather simplistic already, however, if an exception is raised by one of them, we'd end up triggering a NULL-pointer deref. Not ideal... Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=206299 Signed-off-by: Ben Skeggs Signed-off-by: Sasha Levin --- drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.c index 9d90d8b4b7e65..f5a8db1bb8b72 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.c @@ -72,6 +72,8 @@ nv50_disp_chan_mthd(struct nv50_disp_chan *chan, int debug) if (debug > subdev->debug) return; + if (!mthd) + return; for (i = 0; (list = mthd->data[i].mthd) != NULL; i++) { u32 base = chan->head * mthd->addr; -- 2.20.1