From: Simon Horman <horms@kernel.org>
To: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
Pavan Kumar Linga <pavan.kumar.linga@intel.com>,
Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Subject: Re: [Intel-wired-lan] [PATCH iwl-net v1] idpf: fix potential memory leak on kcalloc() failure
Date: Fri, 11 Apr 2025 16:51:44 +0100 [thread overview]
Message-ID: <20250411155144.GJ395307@horms.kernel.org> (raw)
In-Reply-To: <Z/ij+J8kGYM5ezC/@mev-dev.igk.intel.com>
On Fri, Apr 11, 2025 at 07:09:12AM +0200, Michal Swiatkowski wrote:
> On Mon, Apr 07, 2025 at 11:43:50AM +0100, Simon Horman wrote:
> > On Fri, Apr 04, 2025 at 12:54:21PM +0200, Michal Swiatkowski wrote:
> > > In case of failing on rss_data->rss_key allocation the function is
> > > freeing vport without freeing earlier allocated q_vector_idxs. Fix it.
> > >
> > > Move from freeing in error branch to goto scheme.
> > >
> > > Fixes: 95af467d9a4e ("idpf: configure resources for RX queues")
> >
> > Hi Michal,
> >
> > WRT leaking q_vector_indxs, that allocation is not present at
> > the commit cited above, so I think the correct Fixes tag for
> > that problem is the following, where that allocation was added:
> >
> > Fixes: d4d558718266 ("idpf: initialize interrupts and enable vport")
>
> Thanks for checking that. I agree, my fixes is wrong.
>
> >
> > I do note that adapter->vport_config[idx] may be allocated but
> > not freed on error in idpf_vport_alloc(). But I assume that this
> > is not a leak as it will eventually be cleaned up by idpf_remove().
>
> Right, it will be better to free it directly for better readable.
> Probably candidate for net-next changes.
Thanks, that does sound like a nice idea.
...
WARNING: multiple messages have this Message-ID (diff)
From: Simon Horman <horms@kernel.org>
To: Michal Swiatkowski <michal.swiatkowski@linux.intel.com>
Cc: intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
Pavan Kumar Linga <pavan.kumar.linga@intel.com>,
Aleksandr Loktionov <aleksandr.loktionov@intel.com>
Subject: Re: [PATCH iwl-net v1] idpf: fix potential memory leak on kcalloc() failure
Date: Fri, 11 Apr 2025 16:51:44 +0100 [thread overview]
Message-ID: <20250411155144.GJ395307@horms.kernel.org> (raw)
In-Reply-To: <Z/ij+J8kGYM5ezC/@mev-dev.igk.intel.com>
On Fri, Apr 11, 2025 at 07:09:12AM +0200, Michal Swiatkowski wrote:
> On Mon, Apr 07, 2025 at 11:43:50AM +0100, Simon Horman wrote:
> > On Fri, Apr 04, 2025 at 12:54:21PM +0200, Michal Swiatkowski wrote:
> > > In case of failing on rss_data->rss_key allocation the function is
> > > freeing vport without freeing earlier allocated q_vector_idxs. Fix it.
> > >
> > > Move from freeing in error branch to goto scheme.
> > >
> > > Fixes: 95af467d9a4e ("idpf: configure resources for RX queues")
> >
> > Hi Michal,
> >
> > WRT leaking q_vector_indxs, that allocation is not present at
> > the commit cited above, so I think the correct Fixes tag for
> > that problem is the following, where that allocation was added:
> >
> > Fixes: d4d558718266 ("idpf: initialize interrupts and enable vport")
>
> Thanks for checking that. I agree, my fixes is wrong.
>
> >
> > I do note that adapter->vport_config[idx] may be allocated but
> > not freed on error in idpf_vport_alloc(). But I assume that this
> > is not a leak as it will eventually be cleaned up by idpf_remove().
>
> Right, it will be better to free it directly for better readable.
> Probably candidate for net-next changes.
Thanks, that does sound like a nice idea.
...
next prev parent reply other threads:[~2025-04-11 15:59 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-04 10:54 [Intel-wired-lan] [PATCH iwl-net v1] idpf: fix potential memory leak on kcalloc() failure Michal Swiatkowski
2025-04-04 10:54 ` Michal Swiatkowski
2025-04-07 10:43 ` [Intel-wired-lan] " Simon Horman
2025-04-07 10:43 ` Simon Horman
2025-04-10 22:04 ` [Intel-wired-lan] " Tony Nguyen
2025-04-11 5:09 ` Michal Swiatkowski
2025-04-11 5:09 ` Michal Swiatkowski
2025-04-11 5:09 ` Michal Swiatkowski
2025-04-11 15:51 ` Simon Horman [this message]
2025-04-11 15:51 ` Simon Horman
2025-04-25 16:49 ` [Intel-wired-lan] " Salin, Samuel
2025-04-25 16:49 ` Salin, Samuel
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=20250411155144.GJ395307@horms.kernel.org \
--to=horms@kernel.org \
--cc=aleksandr.loktionov@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=michal.swiatkowski@linux.intel.com \
--cc=netdev@vger.kernel.org \
--cc=pavan.kumar.linga@intel.com \
/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.