From patchwork Wed Jan 29 16:22:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Fr=C3=A9d=C3=A9ric_Pierret_=28fepitre=29?= X-Patchwork-Id: 232414 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=-8.3 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=ham 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 6E5DDC2D0DB for ; Wed, 29 Jan 2020 16:37:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3DCF020716 for ; Wed, 29 Jan 2020 16:37:31 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=qubes-os.org header.i=frederic.pierret@qubes-os.org header.b="dhkjDT28" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726498AbgA2Qha (ORCPT ); Wed, 29 Jan 2020 11:37:30 -0500 Received: from sender4-of-o53.zoho.com ([136.143.188.53]:21321 "EHLO sender4-of-o53.zoho.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726906AbgA2Qha (ORCPT ); Wed, 29 Jan 2020 11:37:30 -0500 X-Greylist: delayed 901 seconds by postgrey-1.27 at vger.kernel.org; Wed, 29 Jan 2020 11:37:29 EST DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; t=1580314941; s=s; d=qubes-os.org; i=frederic.pierret@qubes-os.org; h=To:Cc:From:Subject:Message-ID:Date:MIME-Version:Content-Type; bh=K19QkB0oonfEXCaZIfhluO472UZCylwbShW7JECNrz4=; b=dhkjDT28WTgsQiHTSAFxGKgecfVFDRMtcygbHG5VvS2NRrseHlU4SAjdx441wML9 lRQJMTHBCNZY9NkzRq85nR6O30PkD9ftQXt58Sym5Qn9ii+Zmp8tPKkbXtPWhGMXHfQ J96j7NstVXnSFIORDMFKE5UoXKvuMVvT0oPUaTz4= Received: from [10.137.0.19] (185.246.211.176 [185.246.211.176]) by mx.zohomail.com with SMTPS id 1580314936696574.2486897165325; Wed, 29 Jan 2020 08:22:16 -0800 (PST) To: Ben Skeggs Cc: nouveau@lists.freedesktop.org, stable@vger.kernel.org From: =?utf-8?b?RnLDqWTDqXJpYyBQaWVycmV0?= Subject: nv50_disp_chan_mthd: ensure mthd is not NULL Message-ID: <8a82672e-1a8d-b08e-b387-11ffecd5ba07@qubes-os.org> Date: Wed, 29 Jan 2020 17:22:13 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 MIME-Version: 1.0 X-Zoho-Virus-Status: 1 X-ZohoMailClient: External Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org Dear Ben Skeggs, Please find attached a patch solving a blocking issue I encountered: https://bugzilla.kernel.org/show_bug.cgi?id=206299 Basically, running at least a RTX2080TI on Xen makes a bad mmio error which causes having 'mthd' pointer to be NULL in 'channv50.c'. From the code, it's assumed to be not NULL by accessing directly 'mthd->data[0]' which is the reason of the kernel panic. I simply check if the pointer is not NULL before continuing. Best regards, Frédéric Pierret From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Pierret=20=28fepitre=29?= Date: Sun, 26 Jan 2020 23:24:33 +0100 Subject: [PATCH] nv50_disp_chan_mthd: ensure mthd is not NULL MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pointer to structure array is assumed not NULL by default. It has the consequence to raise a kernel panic when it's not the case. BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=206299 Signed-off-by: Frédéric Pierret (fepitre) --- 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 bcf32d92ee5a..50e3539f33d2 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.21.0