All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thorsten Blum <blum@kernel.org>
To: Joonas Lahtinen <joonas.lahtinen@linux.intel.com>
Cc: Chris Wilson <chris@chris-wilson.co.uk>,
	David Airlie <airlied@gmail.com>,
	Jani Nikula <jani.nikula@linux.intel.com>,
	Lionel Landwerlin <lionel.g.landwerlin@intel.com>,
	Rodrigo Vivi <rodrigo.vivi@intel.com>,
	Simona Vetter <simona@ffwll.ch>,
	Thorsten Blum <thorsten.blum@linux.dev>,
	Tvrtko Ursulin <tursulin@ursulin.net>,
	intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] drm/i915: Fix memory leak in query_perf_config_list()
Date: Thu, 3 Sep 2026 16:50:24 +0200	[thread overview]
Message-ID: <apmJMLS9bdriCN03@kernel.org> (raw)
In-Reply-To: <178815839811.55476.6042238739250760944@jlahtine-mobl>

On Mon, Aug 31, 2026 at 09:39:58AM +0300, Joonas Lahtinen wrote:
> Quoting Thorsten Blum (2026-08-23 23:50:28)
> > 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: stable@vger.kernel.org
> > Signed-off-by: Thorsten Blum <thorsten.blum@linux.dev>
> > ---
> >  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;
> 
> Instead of duplicating the code once more, could we just refactor into
> "goto err_ids;" style to clean up the function?
> 
> Regards, Joonas

I think the cleanup should be a separate patch, since this minimal fix
should make it easier to backport to stable.

Thanks,
Thorsten

  reply	other threads:[~2026-09-03 14:50 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-23 20:50 [PATCH] drm/i915: Fix memory leak in query_perf_config_list() Thorsten Blum
2026-08-26 21:13 ` ✓ i915.CI.BAT: success for " Patchwork
2026-08-26 21:41 ` [PATCH] " Andi Shyti
2026-08-27  4:08 ` ✗ i915.CI.Full: failure for " Patchwork
2026-08-31  6:39 ` [PATCH] " Joonas Lahtinen
2026-09-03 14:50   ` Thorsten Blum [this message]
2026-09-09 21:20 ` Andi Shyti

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=apmJMLS9bdriCN03@kernel.org \
    --to=blum@kernel.org \
    --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=thorsten.blum@linux.dev \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.