From patchwork Tue Aug 6 12:24:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Krzysztofik X-Patchwork-Id: 11078747 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id ED23713AC for ; Tue, 6 Aug 2019 12:25:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DCFCF28904 for ; Tue, 6 Aug 2019 12:25:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D14602892B; Tue, 6 Aug 2019 12:25:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 9767F28904 for ; Tue, 6 Aug 2019 12:25:25 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 185346E36F; Tue, 6 Aug 2019 12:25:25 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by gabe.freedesktop.org (Postfix) with ESMTPS id 293C16E370 for ; Tue, 6 Aug 2019 12:25:23 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga004.jf.intel.com ([10.7.209.38]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Aug 2019 05:25:23 -0700 X-IronPort-AV: E=Sophos;i="5.64,353,1559545200"; d="scan'208";a="325620171" Received: from jkrzyszt-desk.igk.intel.com ([172.22.244.17]) by orsmga004-auth.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 06 Aug 2019 05:25:20 -0700 From: Janusz Krzysztofik To: Chris Wilson Date: Tue, 6 Aug 2019 14:24:57 +0200 Message-Id: <20190806122458.15237-2-janusz.krzysztofik@linux.intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190806122458.15237-1-janusz.krzysztofik@linux.intel.com> References: <20190806122458.15237-1-janusz.krzysztofik@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [RFC PATCH 1/2] drm/i915: Fix NULL pointer dereference in execlists' trace_ports() X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: intel-gfx@lists.freedesktop.org, Matthew Auld Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP If it ever happens trace_port() helper is called with NULL port 0, kernel panic occurs. Fix it. Signed-off-by: Janusz Krzysztofik --- drivers/gpu/drm/i915/gt/intel_lrc.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/intel_lrc.c b/drivers/gpu/drm/i915/gt/intel_lrc.c index d9061d9348cb..aa138aaf8743 100644 --- a/drivers/gpu/drm/i915/gt/intel_lrc.c +++ b/drivers/gpu/drm/i915/gt/intel_lrc.c @@ -656,10 +656,10 @@ trace_ports(const struct intel_engine_execlists *execlists, GEM_TRACE("%s: %s { %llx:%lld%s, %llx:%lld }\n", engine->name, msg, - ports[0]->fence.context, - ports[0]->fence.seqno, - i915_request_completed(ports[0]) ? "!" : - i915_request_started(ports[0]) ? "*" : + ports[0] ? ports[0]->fence.context : 0, + ports[0] ? ports[0]->fence.seqno : 0, + ports[0] && i915_request_completed(ports[0]) ? "!" : + ports[0] && i915_request_started(ports[0]) ? "*" : "", ports[1] ? ports[1]->fence.context : 0, ports[1] ? ports[1]->fence.seqno : 0);