]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
drm/i915: Return NULL on error in active_instance
authorJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Wed, 24 Jun 2026 09:09:40 +0000 (12:09 +0300)
committerJoonas Lahtinen <joonas.lahtinen@linux.intel.com>
Tue, 30 Jun 2026 06:35:45 +0000 (09:35 +0300)
Avoid returning &node->base when node is NULL due to OOM
during GFP_ATOMIC allocation.

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

Reported-by: Martin Hodo <martin.hodo@intel.com>
Fixes: bfaae47db3c0 ("drm/i915: make lockdep slightly happier about execbuf.")
Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Cc: Thomas Hellström <thomas.hellstrom@linux.intel.com>
Cc: Simona Vetter <simona.vetter@ffwll.ch>
Cc: <stable@vger.kernel.org> # v5.13+
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Reviewed-by: Sebastian Brzezinka <sebastian.brzezinka@intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
Link: https://patch.msgid.link/20260624090940.74840-1-joonas.lahtinen@linux.intel.com
(cherry picked from commit 6029bc064f0b1bac184203a50fbaaf070fa18832)
Signed-off-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
drivers/gpu/drm/i915/i915_active.c

index 5cb7a72774a0ea32781b92d97b9669b2b394447b..aa77def0bc0d2fecbc4838c8b68edee4e1ccc67b 100644 (file)
@@ -318,7 +318,7 @@ active_instance(struct i915_active *ref, u64 idx)
         */
        node = kmem_cache_alloc(slab_cache, GFP_ATOMIC);
        if (!node)
-               goto out;
+               goto err;
 
        __i915_active_fence_init(&node->base, NULL, node_retire);
        node->ref = ref;
@@ -332,6 +332,11 @@ out:
        spin_unlock_irq(&ref->tree_lock);
 
        return &node->base;
+
+err:
+       spin_unlock_irq(&ref->tree_lock);
+
+       return NULL;
 }
 
 void __i915_active_init(struct i915_active *ref,