Skip to content

Commit f1cdb59

Browse files
committed
drm/i915: Prevent potential null-ptr-deref in engine_init_common
If measure_breadcrumb_dw() returns an error and bce isn't created, this commit ensures that intel_engine_destroy_pinned_context() is not called with a NULL bce. v2: Fix the subject s/UAF/null-ptr-deref(Jani) Fixes: b352749 ("drm/i915: Create a kernel context for GGTT updates") Cc: Oak Zeng <[email protected]> Cc: Andi Shyti <[email protected]> Cc: Jani Nikula <[email protected]> Signed-off-by: Nirmoy Das <[email protected]> Reviewed-by: Andi Shyti <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent 2d6e2b1 commit f1cdb59

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/gpu/drm/i915/gt/intel_engine_cs.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1491,7 +1491,8 @@ static int engine_init_common(struct intel_engine_cs *engine)
14911491
return 0;
14921492

14931493
err_bce_context:
1494-
intel_engine_destroy_pinned_context(bce);
1494+
if (bce)
1495+
intel_engine_destroy_pinned_context(bce);
14951496
err_ce_context:
14961497
intel_engine_destroy_pinned_context(ce);
14971498
return ret;

0 commit comments

Comments
 (0)