]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/i915/gem: Fix NULL deref in I915_CONTEXT_PARAM_SSEU
authorJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Wed, 1 Jul 2026 07:55:55 +0000 (10:55 +0300)
committerRodrigo Vivi <rodrigo.vivi@intel.com>
Mon, 6 Jul 2026 14:25:54 +0000 (10:25 -0400)
Setting context engine slot N into I915_ENGINE_CLASS_INVALID /
I915_ENGINE_CLASS_INVALID_NONE and attempting to apply
I915_CONTEXT_PARAM_SSEU to the same slot N will deref NULL.
Fix that.

Discovered using AI-assisted static analysis confirmed by
Intel Product Security.

Reported-by: Martin Hodo <martin.hodo@intel.com>
Fixes: d4433c7600f7 ("drm/i915/gem: Use the proto-context to handle create parameters (v5)")
Cc: Faith Ekstrand <faith.ekstrand@collabora.com>
Cc: Simona Vetter <simona.vetter@ffwll.ch>
Cc: Tvrtko Ursulin <tvrtko.ursulin@igalia.com>
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: <stable@vger.kernel.org> # v5.15+
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Reviewed-by: Andi Shyti <andi.shyti@linux.intel.com>
Link: https://patch.msgid.link/20260701075555.52142-1-joonas.lahtinen@linux.intel.com
(cherry picked from commit 36eda5b5c2d40da41cc0a5403c26986237cf9e87)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
drivers/gpu/drm/i915/gem/i915_gem_context.c

index aeafe1742d3080a2a3c1655da5b8bd2045436ca4..347d1f2c05f502529fa385f8114f3df14231de59 100644 (file)
@@ -850,7 +850,7 @@ static int set_proto_ctx_sseu(struct drm_i915_file_private *fpriv,
                pe = &pc->user_engines[idx];
 
                /* Only render engine supports RPCS configuration. */
-               if (pe->engine->class != RENDER_CLASS)
+               if (!pe->engine || pe->engine->class != RENDER_CLASS)
                        return -EINVAL;
 
                sseu = &pe->sseu;