Skip to content

Commit 45bcbd4

Browse files
Cosmin RatiuPaolo Abeni
authored andcommitted
net/mlx5: HWS, don't destroy more bwc queue locks than allocated
hws_send_queues_bwc_locks_destroy destroyed more queue locks than allocated, leading to memory corruption (occasionally) and warnings such as DEBUG_LOCKS_WARN_ON(mutex_is_locked(lock)) in __mutex_destroy because sometimes, the 'mutex' being destroyed was random memory. The severity of this problem is proportional to the number of queues configured because the code overreaches beyond the end of the bwc_send_queue_locks array by 2x its length. Fix that by using the correct number of bwc queues. Fixes: 2ca6259 ("net/mlx5: HWS, added send engine and context handling") Signed-off-by: Cosmin Ratiu <[email protected]> Signed-off-by: Yevgeny Kliteynik <[email protected]> Signed-off-by: Tariq Toukan <[email protected]> Signed-off-by: Paolo Abeni <[email protected]>
1 parent 5aa2184 commit 45bcbd4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/net/ethernet/mellanox/mlx5/core/steering/hws/mlx5hws_send.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -941,7 +941,7 @@ static void __hws_send_queues_close(struct mlx5hws_context *ctx, u16 queues)
941941

942942
static void hws_send_queues_bwc_locks_destroy(struct mlx5hws_context *ctx)
943943
{
944-
int bwc_queues = ctx->queues - 1;
944+
int bwc_queues = mlx5hws_bwc_queues(ctx);
945945
int i;
946946

947947
if (!mlx5hws_context_bwc_supported(ctx))

0 commit comments

Comments
 (0)