FAILED: patch "[PATCH] drm/i915: Fix bug in user proto-context creation that leaked" failed to apply to 5.14-stable tree
Subsystems (3)
[email protected]
maintainerThe patch below does not apply to the 5.14-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From af628cdd64e11f03181a5a19645768ed4687bda4 Mon Sep 17 00:00:00 2001
From: Matthew Brost <[email protected]>
Date: Fri, 1 Oct 2021 08:58:25 -0700
Subject: [PATCH] drm/i915: Fix bug in user proto-context creation that leaked
contexts
Set number of engines before attempting to create contexts so the function free_engines can clean up properly. Also check return of alloc_engines for NULL.
v2:
(Tvrtko)
- Send as stand alone patch
(John Harrison)
- Check for alloc_engines returning NULL
v3:
(Checkpatch / Tvrtko)
- Remove braces around single line if statement
drivers/gpu/drm/i915/gem/i915_gem_context.c +4 -1
@@ -937,6 +937,10 @@ static struct i915_gem_engines *user_engines(struct i915_gem_context *ctx,unsigned int n; e =alloc_engines (num_engines); +if (!e) +return ERR_PTR (-ENOMEM ); + e->num_engines = num_engines; +for (n =0 ; n < num_engines; n++) {struct intel_context *ce;int ret;
@@ -970,7 +974,6 @@ static struct i915_gem_engines *user_engines(struct i915_gem_context *ctx, goto free_engines; } } - e->num_engines = num_engines;return e;