* [PATCH] drm/i915: Free OA config IDs on reallocation failure
@ 2026-07-15 22:26 Emre Cecanpunar
0 siblings, 0 replies; only message in thread
From: Emre Cecanpunar @ 2026-07-15 22:26 UTC (permalink / raw)
To: intel-gfx
Cc: jani.nikula, joonas.lahtinen, rodrigo.vivi, tursulin, airlied,
simona, chris, lionel.g.landwerlin, dri-devel, linux-kernel,
Emre Cecanpunar
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2026-07-15 22:26 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-07-15 22:26 [PATCH] drm/i915: Free OA config IDs on reallocation failure Emre Cecanpunar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®