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-next>] [day] [month] [year] [list]
Message-ID: <20250519112747.12365-1-hanchunchao@inspur.com>
Date: Mon, 19 May 2025 19:27:47 +0800
From: Charles Han <hanchunchao@...pur.com>
To: <saeedm@...dia.com>, <tariqt@...dia.com>, <leon@...nel.org>,
	<andrew+netdev@...n.ch>, <davem@...emloft.net>, <edumazet@...gle.com>,
	<kuba@...nel.org>, <pabeni@...hat.com>, <roid@...dia.com>,
	<jianbol@...dia.com>
CC: <linux-rdma@...r.kernel.org>, <linux-kernel@...r.kernel.org>, Charles Han
	<hanchunchao@...pur.com>
Subject: [PATCH] net/mlx5: Add NULL check in mlx5e_tc_nic_create_miss_table

The mlx5e_tc_nic_create_miss_table() function did not check the
return value of mlx5_get_flow_namespace(). This could lead to
subsequent code using an invalid flow namespace pointer,
potentially causing crashes or undefined behavior.

Fixes: 794131c40850 ("net/mlx5: E-Switch, Return EBUSY if can't get mode lock")
Signed-off-by: Charles Han <hanchunchao@...pur.com>
---
 drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index f1d908f61134..81f0db29a2bb 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -5213,6 +5213,10 @@ static int mlx5e_tc_nic_create_miss_table(struct mlx5e_priv *priv)
 	ft_attr.level = MLX5E_TC_MISS_LEVEL;
 	ft_attr.prio = 0;
 	ns = mlx5_get_flow_namespace(priv->mdev, MLX5_FLOW_NAMESPACE_KERNEL);
+	if (!ns) {
+		mlx5_core_err(priv->mdev, "Failed to get flow namespace\n");
+		return -EOPNOTSUPP;
+	}
 
 	*ft = mlx5_create_auto_grouped_flow_table(ns, &ft_attr);
 	if (IS_ERR(*ft)) {
-- 
2.43.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ