From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
Intel graphics driver community testing & development
<intel-gfx@lists.freedesktop.org>
Cc: Direct Rendering Infrastructure - Development
<dri-devel@lists.freedesktop.org>,
Martin Hodo <martin.hodo@intel.com>,
Faith Ekstrand <faith.ekstrand@collabora.com>,
Simona Vetter <simona.vetter@ffwll.ch>,
Tvrtko Ursulin <tvrtko.ursulin@igalia.com>,
stable@vger.kernel.org
Subject: Re: [PATCH] drm/i915/gem: Do not leak siblings[] on proto context error
Date: Wed, 1 Jul 2026 13:20:03 +0200 [thread overview]
Message-ID: <334874ba-a0e9-4b6d-b148-e8173786fd9a@linux.intel.com> (raw)
In-Reply-To: <20260701073030.44850-1-joonas.lahtinen@linux.intel.com>
Reviewed-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
On 7/1/26 09:30, Joonas Lahtinen wrote:
> After a successful BALANCE/PARALLEL_SUBMIT extension on context
> creation, error during processing of next user extension leaks
> the siblings[] array. 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>
> ---
> drivers/gpu/drm/i915/gem/i915_gem_context.c | 22 +++++++++++++--------
> 1 file changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> index aeafe1742d30..87fce2adfeef 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> @@ -769,8 +769,8 @@ static int set_proto_ctx_engines(struct drm_i915_file_private *fpriv,
> struct intel_engine_cs *engine;
>
> if (copy_from_user(&ci, &user->engines[n], sizeof(ci))) {
> - kfree(set.engines);
> - return -EFAULT;
> + err = -EFAULT;
> + goto err;
> }
>
> memset(&set.engines[n], 0, sizeof(set.engines[n]));
> @@ -786,8 +786,8 @@ static int set_proto_ctx_engines(struct drm_i915_file_private *fpriv,
> drm_dbg(&i915->drm,
> "Invalid engine[%d]: { class:%d, instance:%d }\n",
> n, ci.engine_class, ci.engine_instance);
> - kfree(set.engines);
> - return -ENOENT;
> + err = -ENOENT;
> + goto err;
> }
>
> set.engines[n].type = I915_GEM_ENGINE_TYPE_PHYSICAL;
> @@ -800,15 +800,21 @@ static int set_proto_ctx_engines(struct drm_i915_file_private *fpriv,
> set_proto_ctx_engines_extensions,
> ARRAY_SIZE(set_proto_ctx_engines_extensions),
> &set);
> - if (err) {
> - kfree(set.engines);
> - return err;
> - }
> + if (err)
> + goto err_extensions;
>
> pc->num_user_engines = set.num_engines;
> pc->user_engines = set.engines;
>
> return 0;
> +
> +err_extensions:
> + for (n = 0; n < set.num_engines; n++)
> + kfree(set.engines[n].siblings);
> +err:
> + kfree(set.engines);
> +
> + return err;
> }
>
> static int set_proto_ctx_sseu(struct drm_i915_file_private *fpriv,
next prev parent reply other threads:[~2026-07-01 11:19 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-01 7:30 [PATCH] drm/i915/gem: Do not leak siblings[] on proto context error Joonas Lahtinen
2026-07-01 7:41 ` sashiko-bot
2026-07-01 8:08 ` Joonas Lahtinen
2026-07-01 8:45 ` ✗ i915.CI.BAT: failure for " Patchwork
2026-07-01 10:39 ` ✓ i915.CI.BAT: success for drm/i915/gem: Do not leak siblings[] on proto context error (rev2) Patchwork
2026-07-01 11:20 ` Maarten Lankhorst [this message]
2026-07-01 22:18 ` ✗ i915.CI.Full: failure " Patchwork
2026-07-02 16:03 ` ✗ i915.CI.BAT: failure for drm/i915/gem: Do not leak siblings[] on proto context error (rev3) Patchwork
2026-07-03 9:10 ` ✓ i915.CI.BAT: success for drm/i915/gem: Do not leak siblings[] on proto context error (rev4) Patchwork
2026-07-04 2:36 ` ✗ i915.CI.Full: failure " Patchwork
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=334874ba-a0e9-4b6d-b148-e8173786fd9a@linux.intel.com \
--to=maarten.lankhorst@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=faith.ekstrand@collabora.com \
--cc=intel-gfx@lists.freedesktop.org \
--cc=joonas.lahtinen@linux.intel.com \
--cc=martin.hodo@intel.com \
--cc=simona.vetter@ffwll.ch \
--cc=stable@vger.kernel.org \
--cc=tvrtko.ursulin@igalia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.