Commit f1cdb599 authored by Nirmoy Das's avatar Nirmoy Das

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: b3527499 ("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: default avatarNirmoy Das <nirmoy.das@intel.com>
Reviewed-by: default avatarAndi Shyti <andi.shyti@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20231011122547.7085-1-nirmoy.das@intel.com
parent 2d6e2b10
...@@ -1491,6 +1491,7 @@ static int engine_init_common(struct intel_engine_cs *engine) ...@@ -1491,6 +1491,7 @@ static int engine_init_common(struct intel_engine_cs *engine)
return 0; return 0;
err_bce_context: err_bce_context:
if (bce)
intel_engine_destroy_pinned_context(bce); intel_engine_destroy_pinned_context(bce);
err_ce_context: err_ce_context:
intel_engine_destroy_pinned_context(ce); intel_engine_destroy_pinned_context(ce);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment