net/mlx5/hws: fix action creation check
Fix segmentation fault when a user will request to allocate
a HWS action while current device doesn't support HWS.
Fixes: f8c8a6d844
("net/mlx5/hws: add action object")
Signed-off-by: Alex Vesker <valex@nvidia.com>
Reviewed-by: Erez Shitrit <erezsh@nvidia.com>
Acked-by: Matan Azrad <matan@nvidia.com>
This commit is contained in:
parent
da81066192
commit
891fd2c116
@ -697,6 +697,13 @@ mlx5dr_action_create_generic(struct mlx5dr_context *ctx,
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (mlx5dr_action_is_hws_flags(flags) &&
|
||||
!(ctx->flags & MLX5DR_CONTEXT_FLAG_HWS_SUPPORT)) {
|
||||
DR_LOG(ERR, "Cannot create HWS action since HWS is not supported");
|
||||
rte_errno = ENOTSUP;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
action = simple_calloc(1, sizeof(*action));
|
||||
if (!action) {
|
||||
DR_LOG(ERR, "Failed to allocate memory for action [%d]", action_type);
|
||||
|
Loading…
Reference in New Issue
Block a user