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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <edc2fd39-c8b7-40eb-9148-85e97eb32af4@nvidia.com>
Date: Mon, 9 Feb 2026 08:36:14 +0200
From: Shay Drori <shayd@...dia.com>
To: Ваторопин Андрей
	<a.vatoropin@...t.ru>, Saeed Mahameed <saeedm@...dia.com>
CC: Leon Romanovsky <leon@...nel.org>, Tariq Toukan <tariqt@...dia.com>, "Mark
 Bloch" <mbloch@...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>, Gal Pressman
	<gal@...dia.com>, Patrisious Haddad <phaddad@...dia.com>, Gerd Bayer
	<gbayer@...ux.ibm.com>, "Mark Zhang (Networking SW)" <markzhang@...dia.com>,
	"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
	"linux-rdma@...r.kernel.org" <linux-rdma@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"lvc-project@...uxtesting.org" <lvc-project@...uxtesting.org>,
	"stable@...r.kernel.org" <stable@...r.kernel.org>
Subject: Re: [PATCH net] net/mlx5: return error in case of lag device
 allocation failure


On 05/02/2026 13:42, Ваторопин Андрей wrote:
> External email: Use caution opening links or attachments
> 
> 
> From: Andrey Vatoropin <a.vatoropin@...t.ru>
> 
> The function __mlx5_lag_dev_add_mdev() attempts to allocate memory for the
> pointer ldev by calling the function mlx5_lag_dev_alloc(). If the memory
> allocation fails, mlx5_lag_dev_alloc() returns NULL and the
> __mlx5_lag_dev_add_mdev() returns 0. Later in the debugfs handlers there is
> an attempt to dereference the ldev pointer.
> 
> Change the return value to "-ENOMEM" to avoid NULL pointer using. When
> "-ENOMEM" is returned __mlx5_lag_dev_add_mdev() will attempt to
> reallocate memory for ldev after a sleep interval.

first, mlx5 treat LAG failures as non-critical. e.g.: if LAG is failing
or isn't supported, the driver won't stop loading.
Second, we have a fix in the pipeline that fixes this by adding
a check in the debugfs creation function, can you wait for it?

> 
> Found by Linux Verification Center (linuxtesting.org) with SVACE.
> 
> Fixes: cac1eb2cf2e3 ("net/mlx5: Lag, properly lock eswitch if needed")> Cc: stable@...r.kernel.org
> Signed-off-by: Andrey Vatoropin <a.vatoropin@...t.ru>
> ---
>   drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
> index a459a30f36ca..6e914472a2d7 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/lag/lag.c
> @@ -1392,7 +1392,7 @@ static int __mlx5_lag_dev_add_mdev(struct mlx5_core_dev *dev)
>                  ldev = mlx5_lag_dev_alloc(dev);
>                  if (!ldev) {
>                          mlx5_core_err(dev, "Failed to alloc lag dev\n");
> -                       return 0;
> +                       return -ENOMEM;

Also, This change could lead to endless loop in mlx5_lag_add_mdev().

>                  }
>                  mlx5_ldev_add_mdev(ldev, dev);
>                  return 0;
> --
> 2.43.0

Thanks
Shay


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ