drm/i915: Prevent potential UAF in engine_init_common
Subsystems (2)
PATCH 1/1 drm/i915: Prevent potential UAF 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.
--- drivers/gpu/drm/i915/gt/intel_engine_cs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/gt/intel_engine_cs.c +2 -1
@@ -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;
Signature · 1 line
2.41.0
Jani Nikula
maintainerQuoted 3 lines · Nirmoy Das
If
measure_breadcrumb_dw()returns an error and bce isn't created, this commit ensures thatintel_engine_destroy_pinned_context()is not called with a NULL bce.
So it's a potential NULL pointer dereference, not use after free like the subject says. Please fix the subject.
BR,
Jani.
Quoted 23 lines
Fixes b35274993680 ("drm/i915: Create a kernel context for GGTT updates")Cc Oak Zeng <[email protected]>Cc Andi Shyti <[email protected]>Signed-off-by Nirmoy Das <[email protected]>--- drivers/gpu/drm/i915/gt/intel_engine_cs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/gt/intel_engine_cs.c +2
-1@@ -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;
Signature · 1 line
Jani Nikula, Intel
Quoted 6 lines · Jani Nikula
Quoted 3 lines · Nirmoy Das
If
measure_breadcrumb_dw()returns an error and bce isn't created, this commit ensures thatintel_engine_destroy_pinned_context()is not called with a NULL bce.So it's a potential NULL pointer dereference, not use after free like the subject says. Please fix the subject.
ah right. I will resend.
Thanks,
Nirmoy
Quoted 27 lines
BR,
Jani.Quoted 22 lines
Fixes b35274993680 ("drm/i915: Create a kernel context for GGTT updates")Cc Oak Zeng <[email protected]>Cc Andi Shyti <[email protected]>Signed-off-by Nirmoy Das <[email protected]>--- drivers/gpu/drm/i915/gt/intel_engine_cs.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/gt/intel_engine_cs.c +2
-1@@ -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;
Hi Nirmoy,
Quoted 8 lines · Nirmoy Das
If
measure_breadcrumb_dw()returns an error and bce isn't created, this commit ensures thatintel_engine_destroy_pinned_context()is not called with a NULL bce.Fixes b35274993680 ("drm/i915: Create a kernel context for GGTT updates")Cc Oak Zeng <[email protected]>Cc Andi Shyti <[email protected]>Signed-off-by Nirmoy Das <[email protected]>
Andi
Hi Andi,
Quoted 7 lines · Andi Shyti
Hi Nirmoy,
Quoted 4 lines · Nirmoy Das
If
measure_breadcrumb_dw()returns an error and bce isn't created, this commit ensures thatintel_engine_destroy_pinned_context()is not called with a NULL bce.
Quoted 5 lines
Quoted 4 lines
Fixes b35274993680 ("drm/i915: Create a kernel context for GGTT updates")Cc Oak Zeng <[email protected]>Cc Andi Shyti <[email protected]>Signed-off-by Nirmoy Das <[email protected]>Reviewed-by Andi Shyti <[email protected]>
Resent with a fixed subject. Please check again.
Thanks,
Nirmoy
Quoted 2 lines
Andi