From: sashiko-bot@kernel.org
To: "Joonas Lahtinen" <joonas.lahtinen@linux.intel.com>
Cc: dri-devel@lists.freedesktop.org
Subject: Re: [PATCH] drm/i915/gem: Do not leak siblings[] on proto context error
Date: Wed, 01 Jul 2026 07:41:36 +0000 [thread overview]
Message-ID: <20260701074137.84A9B1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260701073030.44850-1-joonas.lahtinen@linux.intel.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [Critical] Unchecked NULL pointer dereference of `pe->engine` in `set_proto_ctx_sseu()`.
--
commit 65a99ba2c873d452c04e00448f3e025e69552b68
Author: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
drm/i915/gem: Do not leak siblings[] on proto context error
This commit fixes a memory leak in the context creation error path.
It ensures the siblings[] array is properly freed if an error happens
while processing user extensions.
> diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c
> index aeafe1742d308..87fce2adfeefb 100644
> --- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
> +++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
[ ... ]
> @@ -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);
[ ... ]
> +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,
[Severity: Critical]
This is a pre-existing issue, but could this cause a NULL pointer
dereference later in set_proto_ctx_sseu()?
If a user creates a proto-context and uses I915_CONTEXT_PARAM_ENGINES to
set an engine array with an I915_ENGINE_CLASS_INVALID entry,
set_proto_ctx_engines() initializes the slot to 0 and skips setting
pe->engine.
If the user then calls I915_CONTEXT_PARAM_SSEU and specifies the index of
that invalid engine, set_proto_ctx_sseu() executes this:
idx = array_index_nospec(idx, pc->num_user_engines);
pe = &pc->user_engines[idx];
/* Only render engine supports RPCS configuration. */
if (pe->engine->class != RENDER_CLASS)
return -EINVAL;
Does pe->engine need to be checked for NULL before dereferencing it here, to
prevent a panic?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260701073030.44850-1-joonas.lahtinen@linux.intel.com?part=1
next prev parent reply other threads:[~2026-07-01 7:41 UTC|newest]
Thread overview: 4+ 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 [this message]
2026-07-01 8:08 ` Joonas Lahtinen
2026-07-01 11:20 ` Maarten Lankhorst
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=20260701074137.84A9B1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=joonas.lahtinen@linux.intel.com \
--cc=sashiko-reviews@lists.linux.dev \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox