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] [day] [month] [year] [list]
Message-ID: <7f9695f0-8753-472a-9e92-585389a6d21e@gmail.com>
Date: Mon, 8 Sep 2025 10:28:07 +0300
From: Tariq Toukan <ttoukan.linux@...il.com>
To: Makar Semyonov <m.semenov@...ltd.ru>, Saeed Mahameed <saeedm@...dia.com>
Cc: Leon Romanovsky <leon@...nel.org>, Tariq Toukan <tariqt@...dia.com>,
 Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller"
 <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
 Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
 Sabrina Dubroca <sd@...asysnail.net>, netdev@...r.kernel.org,
 linux-rdma@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] eth: mlx5: fix double free of flow_table groups on
 allocation failure



On 04/09/2025 17:08, Makar Semyonov wrote:
> In macsec_fs_rx_create_crypto_table_groups(), when memory allocation for
> 'in' fails, 'ft->g' is cleared once. However, the function returns
> a non-zero error which causes macsec_fs_rx_destroy to be called.
> Inside it, macsec_fs_destroy_flow_table is invoked, which attempts
> to clear 'ft->g' again, leading to a double free.
> 
> This commit fixes the issue by setting 'ft->g' to NULL immediately
> after the first clearance in macsec_fs_rx_create_crypto_table_groups()
> to prevent a double free when macsec_fs_destroy_flow_table attempts to
> free it again.
> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Signed-off-by: Makar Semyonov <m.semenov@...ltd.ru>
> ---
>   drivers/net/ethernet/mellanox/mlx5/core/lib/macsec_fs.c | 1 +
>   1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lib/macsec_fs.c b/drivers/net/ethernet/mellanox/mlx5/core/lib/macsec_fs.c
> index 4a078113e292..5e86c277f33a 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/lib/macsec_fs.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/lib/macsec_fs.c
> @@ -1066,6 +1066,7 @@ static int macsec_fs_rx_create_crypto_table_groups(struct mlx5_macsec_flow_table
>   	in = kvzalloc(inlen, GFP_KERNEL);
>   	if (!in) {
>   		kfree(ft->g);
> +		ft->g = NULL;
>   		return -ENOMEM;
>   	}
>   

Code and commit message are fine.
Use "net/mlx5" prefix.
Please address comments from Markus Elfring.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ