From nobody Sat Jul 25 16:44:51 2026 Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 845DB3D4112 for ; Wed, 15 Jul 2026 22:26:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784154379; cv=none; b=gEID8I5WoKv5bjrd8hcZyQRDmq+gdQulsMNyNMjCzkboOyG9nYK7fE9d/krbQ1tFcRa/itx+sDv/LGn/FMOg/ioiVj2jgqZMDx8liSoG+qUij8H0DcmqLBtyTRK0VjCgU2EQwCTRtwTHbSn7l3e05OWrWRfvX7XgBEJvAvajlhE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784154379; c=relaxed/simple; bh=Lf0AonJCtxUgmIe9rRVZOxY+Qk14BuPv7LxwQFA0hfs=; h=From:To:Cc:Subject:Date:Message-ID:MIME-Version; b=cCp8eBMefLmr07QybyNUHWyhneXqZ4v7N3cSb2+Zc4xt0xU13FvLIKzJ5nfEj4QaJgH8quv8ly4iD1nMQ/5wHuSm83bevLyj32Xd4J7lMfZptj+TdiwRgAE7HF31+Y3u9k3/PYrI+u9cI64WckVp5awtqgKAxS03y88lSIe5SIo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=cUnD/cwZ; arc=none smtp.client-ip=209.85.221.47 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="cUnD/cwZ" Received: by mail-wr1-f47.google.com with SMTP id ffacd0b85a97d-46f88060e8dso901208f8f.2 for ; Wed, 15 Jul 2026 15:26:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1784154377; x=1784759177; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to:content-type; bh=HznNu2oP3vdo009kQzzHBrfsGvXYlXjkFudERsRqoXE=; b=cUnD/cwZPZPNcM5dYZk8RRQFwfsilmBvyyjyzY4p4iPEUPMpwmxYKN/815FATzSNPz XcDprOu8Snph09VkLH9QgvDcXKDrqbsv1bgeTvDayTgGx5KGkiy/Uv64snjXMwHjL+h6 7TYeX7XunsM+oixn4pnOn26us2afR2MLqhW27g5F7ezOVfe8TZP7diZYzi8WrtlB9VDM N78z2E4I0MxsEBWok3XzplwRFb5dS4C9xtrdmygefAWfLkrO6DNwbZkStXm2wFDiQltA 6e2QgceTBtnLjHiGTOsk0pxi/y0FJLtC//gv7ydB/solWXFYzE5zesiYs0BkT1fBGORk zcLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1784154377; x=1784759177; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to:content-type; bh=HznNu2oP3vdo009kQzzHBrfsGvXYlXjkFudERsRqoXE=; b=Eg8vEu31q8mmgJdcP987otYw43lEfFq0U14yPoFrICnNjBNby3mAjLpDBcmrlR4wmk ZABtT8JUFDH2O0y35D2PPi07r/5Mh3nCkk3a3/2lJ71xyK2B126YTLzEriQbwRWIppp1 7/kmL4onHhPEefPWZyV97lvbr4MmIGGhod70sInbqdUdBLnLok9UtZLIq5jNXkyNcfBZ qU/pCl9fmJYDxeaRvTbahEf3CHJGqAc0yR1vlaf2+hqZZ5KgjsS/IGoRJCceDoRi9Tn2 qfM13t61IyK+cH/lzkPxzorDHxUv6mft0cGjTFb3EVNGRYjzzk39SvYoV/dGOvgBZ7Pv Z6VQ== X-Forwarded-Encrypted: i=1; AHgh+RoIb5oOu3ybtkM5yOPL+ms6FcPbNOqdoyjMjC/dwzofKHr+uiHJI8jc0Oi/PC4D/DpPXPOp1/wI6osdi5w=@vger.kernel.org X-Gm-Message-State: AOJu0YxAQxHvPun2RUyIQ1T2VmZhBz5m7ONo9yW3g6LtjybKhy/PD3fG F31lCSvqxUHfiL4YYoa/4Z8qE7MDCkeKHC+qLSCkLhZ6JRigoo7OCwZn X-Gm-Gg: AfdE7ck/f/3wgchZm62DZ+2LJhCj+WtKZ3c9yG12W3iJ+ery2U4J4BuaKMcTG0DClQg TaPa5Ag5o+TgDRUOw4cyUbaKd5Wo24cL/3DUFfE3efRJIXNy+Q9IlOUnDa/tKUtNIewcPHKpZSh anNuylgIdKBG790fwNi/90bRD+ini6cKscdvXpVwsxrDMsLwH7Yv+tD72JnSJv2iTArb6hAmAWi OOQpLOu2Xrcmg7CZjIyG5hkFC56cipUzsUZc+I3L/ZylBUWqGTk00jq5qjuqkoVHZE/zoPWuBrC QTcX8AM8f7cpCVQfAa9NIwqBLNMVrB0A+F1vi2LLLCgg/6RDIToO9O3Rg4bJjv1ACwdrwCbs+eJ 0tQROd1sqr9e9LXd/WKW3Ir1zmSBNqqWm38g8wJU1N11hTMGnpZxS34OCmsdPaveSeg== X-Received: by 2002:a05:600c:4f94:b0:492:1e4d:d44b with SMTP id 5b1f17b1804b1-493f8835228mr114092515e9.8.1784154376697; Wed, 15 Jul 2026 15:26:16 -0700 (PDT) Received: from fridge ([188.3.249.68]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-49541e93295sm12046815e9.10.2026.07.15.15.26.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jul 2026 15:26:16 -0700 (PDT) From: Emre Cecanpunar 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 Subject: [PATCH] drm/i915: Free OA config IDs on reallocation failure Date: Thu, 16 Jul 2026 01:26:13 +0300 Message-ID: <20260715222613.399409-1-emreleno@gmail.com> X-Mailer: git-send-email 2.55.0 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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 --- 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_priv= ate *i915, ids =3D krealloc(oa_config_ids, n_configs * sizeof(*oa_config_ids), GFP_KERNEL); - if (!ids) + if (!ids) { + kfree(oa_config_ids); return -ENOMEM; + } =20 alloc =3D fetch_and_zero(&n_configs); =20 --=20 2.55.0