Skip to content

Commit

Permalink
net/mlx5: HWS, don't destroy more bwc queue locks than allocated
Browse files Browse the repository at this point in the history
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 <cratiu@nvidia.com>
Signed-off-by: Yevgeny Kliteynik <kliteyn@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
  • Loading branch information
Cosmin Ratiu authored and Paolo Abeni committed Oct 17, 2024
1 parent 5aa2184 commit 45bcbd4
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -941,7 +941,7 @@ static void __hws_send_queues_close(struct mlx5hws_context *ctx, u16 queues)

static void hws_send_queues_bwc_locks_destroy(struct mlx5hws_context *ctx)
{
int bwc_queues = ctx->queues - 1;
int bwc_queues = mlx5hws_bwc_queues(ctx);
int i;

if (!mlx5hws_context_bwc_supported(ctx))
Expand Down

0 comments on commit 45bcbd4

Please sign in to comment.