Message ID | 20250405102008.78451-1-bsdhenrymartin@gmail.com (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | [v1] net/mlx5: Fix null-ptr-deref in mlx5e_tc_nic_create_miss_table() | expand |
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c index 9ba99609999f..538c33c353ad 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c @@ -5216,6 +5216,8 @@ 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) + return -EOPNOTSUPP; *ft = mlx5_create_auto_grouped_flow_table(ns, &ft_attr); if (IS_ERR(*ft)) {
Add NULL check for mlx5_get_flow_namespace() returns in mlx5e_tc_nic_create_miss_table() to prevent NULL pointer dereference. Fixes: 66cb64e292d2 ("net/mlx5e: TC NIC mode, fix tc chains miss table") Signed-off-by: Henry Martin <bsdhenrymartin@gmail.com> --- drivers/net/ethernet/mellanox/mlx5/core/en_tc.c | 2 ++ 1 file changed, 2 insertions(+)