From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 776ECC35643 for ; Fri, 21 Feb 2020 08:39:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 43F192073A for ; Fri, 21 Feb 2020 08:39:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582274371; bh=J82JkTofHDDCykmw5UKeVbFfNcfQzl+TMlBOTvHz5nY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=ZkFl7d3NqAQlpeTyJ1yfoKWfksaLzShjg4UVYPnr68khL3h355iP3IAQ9NfgA/SS9 /3+yPUhgkwTuoVspV6pBT4txMxD31nLt7dEVN6LkwR1OZb10o6Jd/ALqrFwT2j5x/k aFA/y4C24CLeFQjXSd/UmEpckHXPYtZqJoq0ubds= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731147AbgBUIBB (ORCPT ); Fri, 21 Feb 2020 03:01:01 -0500 Received: from mail.kernel.org ([198.145.29.99]:33154 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730649AbgBUIAy (ORCPT ); Fri, 21 Feb 2020 03:00:54 -0500 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 5F8D1206ED; Fri, 21 Feb 2020 08:00:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1582272053; bh=J82JkTofHDDCykmw5UKeVbFfNcfQzl+TMlBOTvHz5nY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ahixFYLf5R9fJviHhnEoR3OS0DLdUjWQQhRTko1Lxgfzn59FHbp1tgm/CNMXsqy/H dI8GUgM5/1y9U/M1FDvZavO9Hnh2ZeoIQR9pe9XpeynCGaue0Zz7hJ+jnry22J49bs KfQ9GYW3gMqU0X44k08FsDqr9L5e7Mf7mlUq7ugs= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ben Skeggs , Sasha Levin Subject: [PATCH 5.5 361/399] drm/nouveau/disp/nv50-: prevent oops when no channel method map provided Date: Fri, 21 Feb 2020 08:41:26 +0100 Message-Id: <20200221072435.827235341@linuxfoundation.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200221072402.315346745@linuxfoundation.org> References: <20200221072402.315346745@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: 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 bcf32d92ee5a9..50e3539f33d22 100644 --- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.c +++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/channv50.c @@ -74,6 +74,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