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:
 <SN6PR02MB4157DBBACA455AC00A24EA08D4292@SN6PR02MB4157.namprd02.prod.outlook.com>
Date: Thu, 28 Nov 2024 21:49:35 +0000
From: Michael Kelley <mhklinux@...look.com>
To: Maxim Levitsky <mlevitsk@...hat.com>, "kvm@...r.kernel.org"
	<kvm@...r.kernel.org>
CC: 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

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.

Michael

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ