Skip to content

Commit

Permalink
drm/i915: Prevent potential null-ptr-deref in engine_init_common
Browse files Browse the repository at this point in the history
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 <oak.zeng@intel.com>
Cc: Andi Shyti <andi.shyti@linux.intel.com>
Cc: Jani Nikula <jani.nikula@linux.intel.com>
Signed-off-by: Nirmoy Das <nirmoy.das@intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231011122547.7085-1-nirmoy.das@intel.com
  • Loading branch information
Nirmoy Das committed Oct 18, 2023
1 parent 2d6e2b1 commit f1cdb59
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/gpu/drm/i915/gt/intel_engine_cs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1491,7 +1491,8 @@ static int engine_init_common(struct intel_engine_cs *engine)
return 0;

err_bce_context:
intel_engine_destroy_pinned_context(bce);
if (bce)
intel_engine_destroy_pinned_context(bce);
err_ce_context:
intel_engine_destroy_pinned_context(ce);
return ret;
Expand Down

0 comments on commit f1cdb59

Please sign in to comment.