Skip to content

Commit

Permalink
net/mlx5: SF: Fix error flow of SFs allocation flow
Browse files Browse the repository at this point in the history
When SF id is unavailable, code jumps to wrong label that accesses
sw id array outside of its range.
Hence, when SF id is not allocated, avoid accessing such array.

Fixes: 8f01054 ("net/mlx5: SF, Add port add delete functionality")
Signed-off-by: Shay Drory <shayd@nvidia.com>
Reviewed-by: Parav Pandit <parav@nvidia.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
  • Loading branch information
Shay Drory authored and Saeed Mahameed committed Mar 10, 2021
1 parent 6fa37d6 commit dc694f1
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/net/ethernet/mellanox/mlx5/core/sf/hw_table.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ int mlx5_sf_hw_table_sf_alloc(struct mlx5_core_dev *dev, u32 usr_sfnum)
}
if (sw_id == -ENOSPC) {
err = -ENOSPC;
goto err;
goto exist_err;
}

hw_fn_id = mlx5_sf_sw_to_hw_id(table->dev, sw_id);
Expand Down

0 comments on commit dc694f1

Please sign in to comment.