Skip to contentSkip to conversation

net/mlx5: Fix null-ptr-deref in mlx5_create_ttc_table()

PATCH New Henry Martin 1 participant 1 message Apr 5, 2025

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/mlx5: Fix null-ptr-deref in mlx5_create_ttc_table()

Add NULL check for mlx5_get_flow_namespace() returns in mlx5_create_ttc_table() to prevent NULL pointer dereference.

Fixes 137f3d50ad2a ("net/mlx5: Support matching on l4_type for ttc_table")
---
 drivers/net/ethernet/mellanox/mlx5/core/lib/fs_ttc.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/net/ethernet/mellanox/mlx5/core/lib/fs_ttc.c +2 -0
index eb3bd9c7f66e..4b31b4c953fb 100644
@@ -728,6 +728,8 @@ struct mlx5_ttc_table *mlx5_create_ttc_table(struct mlx5_core_dev *dev,
 	}
 
 	ns = mlx5_get_flow_namespace(dev, params->ns_type);
+	if (!ns)
+		return ERR_PTR(-EOPNOTSUPP);
 	groups = use_l4_type ? &ttc_groups[TTC_GROUPS_USE_L4_TYPE] :
 			       &ttc_groups[TTC_GROUPS_DEFAULT];
 
Signature · 1 line
2.34.1