[Intel-gfx] [RFC PATCH 1/2] drm/i915: Fix NULL pointer dereference in execlists' trace_ports()

Janusz Krzysztofik janusz.krzysztofik at linux.intel.com
Tue Aug 6 12:24:57 UTC 2019


If it ever happens trace_port() helper is called with NULL port 0,
kernel panic occurs.  Fix it.

Signed-off-by: Janusz Krzysztofik <janusz.krzysztofik at linux.intel.com>
---
 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);
-- 
2.21.0



More information about the Intel-gfx mailing list