Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Sang-Hoon Choi <csh0052@gmail.com>
To: Jani Nikula <jani.nikula@linux.intel.com>,
	Joonas Lahtinen <joonas.lahtinen@linux.intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Tvrtko Ursulin <tursulin@ursulin.net>
Cc: intel-gfx@lists.freedesktop.org,
	Faith Ekstrand <faith.ekstrand@collabora.com>,
	Changyul Lee <lcy8047@gmail.com>
Subject: [PATCH] drm/i915: release context ID when context creation fails
Date: Fri, 02 Oct 2026 19:47:40 +0000	[thread overview]
Message-ID: <20261003.final010.56cd81b38781b9d9@gmail.com> (raw)

On graphics version 13 and later, xa_alloc() reserves a context ID before
i915_gem_create_context() is called. If context creation fails, the
reserved entry is left in context_xa, making the ID unavailable to later
context allocations on the same DRM file.

Release the unused XArray reservation on the failure path.

Fixes: ca06f9363836 ("drm/i915: Finalize contexts in GEM_CONTEXT_CREATE on version 13+")
Reported-by: Changyul Lee <lcy8047@gmail.com>
Assisted-by: LLM
Signed-off-by: Sang-Hoon Choi <csh0052@gmail.com>
---
Compile-tested the affected object with x86_64 allmodconfig
and W=1 (GCC 13.3.0). Base: mainline 3b7cab693ba2bab63774bf5b988e8a61b2ef0f32.
No hardware testing or runtime failure reproduction was performed.

 drivers/gpu/drm/i915/gem/i915_gem_context.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/gpu/drm/i915/gem/i915_gem_context.c b/drivers/gpu/drm/i915/gem/i915_gem_context.c
index c58ffa5a8fa6..4eb715c2da1c 100644
--- a/drivers/gpu/drm/i915/gem/i915_gem_context.c
+++ b/drivers/gpu/drm/i915/gem/i915_gem_context.c
@@ -2421,6 +2421,7 @@ int i915_gem_context_create_ioctl(struct drm_device *dev, void *data,
 		ctx = i915_gem_create_context(i915, ext_data.pc);
 		if (IS_ERR(ctx)) {
 			ret = PTR_ERR(ctx);
+			xa_release(&ext_data.fpriv->context_xa, id);
 			goto err_pc;
 		}
 

             reply	other threads:[~2026-10-02 20:45 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-02 19:47 Sang-Hoon Choi [this message]
2026-10-02 21:04 ` ✗ LGCI.VerificationFailed: failure for drm/i915: release context ID when context creation fails 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=20261003.final010.56cd81b38781b9d9@gmail.com \
    --to=csh0052@gmail.com \
    --cc=faith.ekstrand@collabora.com \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@linux.intel.com \
    --cc=joonas.lahtinen@linux.intel.com \
    --cc=lcy8047@gmail.com \
    --cc=rodrigo.vivi@intel.com \
    --cc=tursulin@ursulin.net \
    /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