Skip to content

Commit da0b986

Browse files
eugene-kobyaktursulin
authored andcommitted
drm/i915: Fix NULL pointer dereference in capture_engine
When the intel_context structure contains NULL, it raises a NULL pointer dereference error in drm_info(). Fixes: e8a3319 ("drm/i915: Allow error capture without a request") Closes: https://gitlab.freedesktop.org/drm/i915/kernel/-/issues/12309 Reviewed-by: Andi Shyti <[email protected]> Cc: John Harrison <[email protected]> Cc: <[email protected]> # v6.3+ Signed-off-by: Eugene Kobyak <[email protected]> Signed-off-by: Andi Shyti <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/xmsgfynkhycw3cf56akp4he2ffg44vuratocsysaowbsnhutzi@augnqbm777at (cherry picked from commit 754302a) Signed-off-by: Tvrtko Ursulin <[email protected]>
1 parent cd3da56 commit da0b986

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

drivers/gpu/drm/i915/i915_gpu_error.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1643,9 +1643,21 @@ capture_engine(struct intel_engine_cs *engine,
16431643
return NULL;
16441644

16451645
intel_engine_get_hung_entity(engine, &ce, &rq);
1646-
if (rq && !i915_request_started(rq))
1647-
drm_info(&engine->gt->i915->drm, "Got hung context on %s with active request %lld:%lld [0x%04X] not yet started\n",
1648-
engine->name, rq->fence.context, rq->fence.seqno, ce->guc_id.id);
1646+
if (rq && !i915_request_started(rq)) {
1647+
/*
1648+
* We want to know also what is the guc_id of the context,
1649+
* but if we don't have the context reference, then skip
1650+
* printing it.
1651+
*/
1652+
if (ce)
1653+
drm_info(&engine->gt->i915->drm,
1654+
"Got hung context on %s with active request %lld:%lld [0x%04X] not yet started\n",
1655+
engine->name, rq->fence.context, rq->fence.seqno, ce->guc_id.id);
1656+
else
1657+
drm_info(&engine->gt->i915->drm,
1658+
"Got hung context on %s with active request %lld:%lld not yet started\n",
1659+
engine->name, rq->fence.context, rq->fence.seqno);
1660+
}
16491661

16501662
if (rq) {
16511663
capture = intel_engine_coredump_add_request(ee, rq, ATOMIC_MAYFAIL);

0 commit comments

Comments
 (0)