]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
net/mlx5e: SHAMPO, Fix incorrect page release
authorDragos Tatulea <dtatulea@nvidia.com>
Mon, 3 Jun 2024 21:22:07 +0000 (00:22 +0300)
committerJakub Kicinski <kuba@kernel.org>
Thu, 6 Jun 2024 03:20:41 +0000 (20:20 -0700)
Under the following conditions:
1) No skb created yet
2) header_size == 0 (no SHAMPO header)
3) header_index + 1 % MLX5E_SHAMPO_WQ_HEADER_PER_PAGE == 0 (this is the
   last page fragment of a SHAMPO header page)

a new skb is formed with a page that is NOT a SHAMPO header page (it
is a regular data page). Further down in the same function
(mlx5e_handle_rx_cqe_mpwrq_shampo()), a SHAMPO header page from
header_index is released. This is wrong and it leads to SHAMPO header
pages being released more than once.

Signed-off-by: Dragos Tatulea <dtatulea@nvidia.com>
Signed-off-by: Tariq Toukan <tariqt@nvidia.com>
Link: https://lore.kernel.org/r/20240603212219.1037656-3-tariqt@nvidia.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/mellanox/mlx5/core/en_rx.c

index 369d101bf03c7f575ae1300d980e7f832df9542b..1ddfa00f923fbae0c54c6b10ff643d98e1025a2c 100644 (file)
@@ -2369,7 +2369,8 @@ static void mlx5e_handle_rx_cqe_mpwrq_shampo(struct mlx5e_rq *rq, struct mlx5_cq
        if (flush)
                mlx5e_shampo_flush_skb(rq, cqe, match);
 free_hd_entry:
-       mlx5e_free_rx_shampo_hd_entry(rq, header_index);
+       if (likely(head_size))
+               mlx5e_free_rx_shampo_hd_entry(rq, header_index);
 mpwrq_cqe_out:
        if (likely(wi->consumed_strides < rq->mpwqe.num_strides))
                return;