From: Emre Cecanpunar <emreleno@gmail.com>
To: intel-gfx@lists.freedesktop.org
Cc: jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com,
rodrigo.vivi@intel.com, tursulin@ursulin.net, airlied@gmail.com,
simona@ffwll.ch, chris@chris-wilson.co.uk,
lionel.g.landwerlin@intel.com, dri-devel@lists.freedesktop.org,
linux-kernel@vger.kernel.org,
Emre Cecanpunar <emreleno@gmail.com>
Subject: [PATCH] drm/i915: Free OA config IDs on reallocation failure
Date: Thu, 16 Jul 2026 01:26:13 +0300 [thread overview]
Message-ID: <20260715222613.399409-1-emreleno@gmail.com> (raw)
When the OA configuration list grows while it is being collected, the
array is resized and the query is retried. krealloc() leaves the original
allocation untouched on failure, so returning directly leaks the array.
Free the original allocation before returning the error.
Fixes: 4f6ccc74a85c ("drm/i915: add support for perf configuration queries")
Signed-off-by: Emre Cecanpunar <emreleno@gmail.com>
---
drivers/gpu/drm/i915/i915_query.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/i915/i915_query.c b/drivers/gpu/drm/i915/i915_query.c
index 0c55fb6e9727..11157fb14db3 100644
--- a/drivers/gpu/drm/i915/i915_query.c
+++ b/drivers/gpu/drm/i915/i915_query.c
@@ -403,8 +403,10 @@ static int query_perf_config_list(struct drm_i915_private *i915,
ids = krealloc(oa_config_ids,
n_configs * sizeof(*oa_config_ids),
GFP_KERNEL);
- if (!ids)
+ if (!ids) {
+ kfree(oa_config_ids);
return -ENOMEM;
+ }
alloc = fetch_and_zero(&n_configs);
--
2.55.0
next reply other threads:[~2026-07-15 22:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-15 22:26 Emre Cecanpunar [this message]
2026-07-15 22:46 ` ✗ LGCI.VerificationFailed: failure for drm/i915: Free OA config IDs on reallocation failure Patchwork
2026-07-27 15:12 ` ✗ i915.CI.Full: failure for drm/i915: Free OA config IDs on reallocation failure (rev2) 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=20260715222613.399409-1-emreleno@gmail.com \
--to=emreleno@gmail.com \
--cc=airlied@gmail.com \
--cc=chris@chris-wilson.co.uk \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=jani.nikula@linux.intel.com \
--cc=joonas.lahtinen@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lionel.g.landwerlin@intel.com \
--cc=rodrigo.vivi@intel.com \
--cc=simona@ffwll.ch \
--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