lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241203162107.GF9361@kernel.org>
Date: Tue, 3 Dec 2024 16:21:07 +0000
From: Simon Horman <horms@...nel.org>
To: Michael Kelley <mhklinux@...look.com>
Cc: Maxim Levitsky <mlevitsk@...hat.com>,
	"kvm@...r.kernel.org" <kvm@...r.kernel.org>,
	Shradha Gupta <shradhagupta@...ux.microsoft.com>,
	Wei Liu <wei.liu@...nel.org>,
	Haiyang Zhang <haiyangz@...rosoft.com>,
	Konstantin Taranov <kotaranov@...rosoft.com>,
	Yury Norov <yury.norov@...il.com>,
	"K. Y. Srinivasan" <kys@...rosoft.com>,
	Eric Dumazet <edumazet@...gle.com>,
	"linux-hyperv@...r.kernel.org" <linux-hyperv@...r.kernel.org>,
	Long Li <longli@...rosoft.com>, Jakub Kicinski <kuba@...nel.org>,
	"David S. Miller" <davem@...emloft.net>,
	Leon Romanovsky <leon@...nel.org>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	Paolo Abeni <pabeni@...hat.com>,
	Andrew Lunn <andrew+netdev@...n.ch>,
	Souradeep Chakrabarti <schakrabarti@...ux.microsoft.com>,
	Dexuan Cui <decui@...rosoft.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] net: mana: Fix memory leak in mana_gd_setup_irqs

On Thu, Nov 28, 2024 at 09:49:35PM +0000, Michael Kelley wrote:
> From: Maxim Levitsky <mlevitsk@...hat.com> Sent: Thursday, November 28, 2024 11:43 AM
> > 
> > Commit 8afefc361209 ("net: mana: Assigning IRQ affinity on HT cores")
> > added memory allocation in mana_gd_setup_irqs of 'irqs' but the code
> > doesn't free this temporary array in the success path.
> > 
> > This was caught by kmemleak.
> > 
> > Fixes: 8afefc361209 ("net: mana: Assigning IRQ affinity on HT cores")
> > Signed-off-by: Maxim Levitsky <mlevitsk@...hat.com>
> > ---
> >  drivers/net/ethernet/microsoft/mana/gdma_main.c | 1 +
> >  1 file changed, 1 insertion(+)
> > 
> > diff --git a/drivers/net/ethernet/microsoft/mana/gdma_main.c
> > b/drivers/net/ethernet/microsoft/mana/gdma_main.c
> > index e97af7ac2bb2..aba188f9f10f 100644
> > --- a/drivers/net/ethernet/microsoft/mana/gdma_main.c
> > +++ b/drivers/net/ethernet/microsoft/mana/gdma_main.c
> > @@ -1375,6 +1375,7 @@ static int mana_gd_setup_irqs(struct pci_dev *pdev)
> >  	gc->max_num_msix = nvec;
> >  	gc->num_msix_usable = nvec;
> >  	cpus_read_unlock();
> > +	kfree(irqs);
> >  	return 0;
> > 
> >  free_irq:
> 
> FWIW, there's a related error path leak. If the kcalloc() to populate
> gc->irq_contexts fails, the irqs array is not freed. Probably could
> extend this patch to fix that leak as well.

Yes, as that problem also appears to be introduced by the cited commit
I agree it would be good to fix them both in one patch.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ