Skip to content

Commit 1d34296

Browse files
ISCAS-Vulabgregkh
authored andcommitted
net/mlx5: handle errors in mlx5_chains_create_table()
[ Upstream commit eab0396 ] In mlx5_chains_create_table(), the return value of mlx5_get_fdb_sub_ns() and mlx5_get_flow_namespace() must be checked to prevent NULL pointer dereferences. If either function fails, the function should log error message with mlx5_core_warn() and return error pointer. Fixes: 39ac237 ("net/mlx5: E-Switch, Refactor chains and priorities") Signed-off-by: Wentao Liang <[email protected]> Reviewed-by: Tariq Toukan <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 102d028 commit 1d34296

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

drivers/net/ethernet/mellanox/mlx5/core/lib/fs_chains.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,11 @@ mlx5_chains_create_table(struct mlx5_fs_chains *chains,
196196
ns = mlx5_get_flow_namespace(chains->dev, chains->ns);
197197
}
198198

199+
if (!ns) {
200+
mlx5_core_warn(chains->dev, "Failed to get flow namespace\n");
201+
return ERR_PTR(-EOPNOTSUPP);
202+
}
203+
199204
ft_attr.autogroup.num_reserved_entries = 2;
200205
ft_attr.autogroup.max_num_groups = chains->group_num;
201206
ft = mlx5_create_auto_grouped_flow_table(ns, &ft_attr);

0 commit comments

Comments
 (0)