Skip to contentSkip to conversation

FAILED: patch "[PATCH] drm/i915: Fix memory leak in query_perf_config_list()" failed to apply to 7.3-stable tree

PATCH Sasha Levin 1 participant 1 message Nov 7

Subsystems (3)
lore
Share & tools
lore

Sasha Levin

author maintainer
#0 lore raw

The patch below does not apply to the 7.3-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-7.3.y
git checkout FETCH_HEAD
git cherry-pick -x 9977e9d84f46d4f12ad35fbbc0ec4638554bce87
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '[email protected]' --subject-prefix 'PATCH 7.3.y' 'HEAD^..'

Thanks,
Sasha

------------------ original commit in Linus's tree ------------------

From 9977e9d84f46d4f12ad35fbbc0ec4638554bce87 Mon Sep 17 00:00:00 2001
From: Thorsten Blum <[email protected]>
Date: Sun, 23 Aug 2026 22:50:28 +0200
Subject: [PATCH] drm/i915: Fix memory leak in query_perf_config_list()

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")
Cc <[email protected]> # v5.5+
---
 drivers/gpu/drm/i915/i915_query.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/i915_query.c +3 -1
index 0c55fb6e9727d..11157fb14db31 100644
@@ -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);
 
Signature · 1 line
2.53.0