Thread (1137 messages) 1137 messages, 12 authors, 23d ago

[PATCH 6.12 0837/1102] drm/i915: Fix memory leak in query_perf_config_list()

flat view
COLD23d REVIEWED: 1 (0M)

From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Date: 2026-09-17 18:50:04
Also in: linux-patches

1 review trailer.

6.12-stable review patch.  If anyone has any objections, please let me know.

------------------

From: Thorsten Blum <redacted>

commit cbd3dafc2003db679ccd2f6c6a2551db79657049 upstream.

When krealloc() fails, free the original oa_config_ids before returning
to avoid a memory leak.

Fixes: 4f6ccc74a85c ("drm/i915: add support for perf configuration queries")
Signed-off-by: Thorsten Blum <redacted>
Cc: <redacted> # v5.5+
Reviewed-by: Andi Shyti <redacted>
Signed-off-by: Andi Shyti <redacted>
Link: https://patch.msgid.link/20260823205028.178597-2-thorsten.blum@linux.dev (local)
(cherry picked from commit 9977e9d84f46d4f12ad35fbbc0ec4638554bce87)
Signed-off-by: Jani Nikula <redacted>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
 drivers/gpu/drm/i915/i915_query.c |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
--- a/drivers/gpu/drm/i915/i915_query.c
+++ b/drivers/gpu/drm/i915/i915_query.c
@@ -401,8 +401,10 @@ static int query_perf_config_list(struct
 		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);
 

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help