]> Git Repo - linux.git/commitdiff
drm/i915: Prevent potential null-ptr-deref in engine_init_common
authorNirmoy Das <[email protected]>
Wed, 11 Oct 2023 12:25:47 +0000 (14:25 +0200)
committerNirmoy Das <[email protected]>
Wed, 18 Oct 2023 10:45:12 +0000 (12:45 +0200)
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: b35274993680 ("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]
drivers/gpu/drm/i915/gt/intel_engine_cs.c

index 179d9546865b036a09baf15f8c2a4bae3ae7396e..4a11219e560e0847637ee61de145eaf5bb79fc05 100644 (file)
@@ -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;
This page took 0.063276 seconds and 4 git commands to generate.