]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commit
mlx5: fix skb leak while fifo resync and push
authorVadim Fedorenko <vadfed@meta.com>
Thu, 2 Feb 2023 17:13:54 +0000 (09:13 -0800)
committerSaeed Mahameed <saeedm@nvidia.com>
Fri, 24 Feb 2023 18:13:18 +0000 (10:13 -0800)
commite435941b1da1a0be4ff8a7ae425774c76a5ac514
treee48aa787968008aa7e9fbb42854d926896954b98
parentbfeda9683dcd697dc84bbd5ce375f659e9590bf5
mlx5: fix skb leak while fifo resync and push

During ptp resync operation SKBs were poped from the fifo but were never
freed neither by napi_consume nor by dev_kfree_skb_any. Add call to
napi_consume_skb to properly free SKBs.

Another leak was happening because mlx5e_skb_fifo_has_room() had an error
in the check. Comparing free running counters works well unless C promotes
the types to something wider than the counter. In this case counters are
u16 but the result of the substraction is promouted to int and it causes
wrong result (negative value) of the check when producer have already
overlapped but consumer haven't yet. Explicit cast to u16 fixes the issue.

Fixes: 58a518948f60 ("net/mlx5e: Add resiliency for PTP TX port timestamp")
Reviewed-by: Gal Pressman <gal@nvidia.com>
Reviewed-by: Tariq Toukan <tariqt@nvidia.com>
Signed-off-by: Vadim Fedorenko <vadfed@meta.com>
Signed-off-by: Saeed Mahameed <saeedm@nvidia.com>
drivers/net/ethernet/mellanox/mlx5/core/en/ptp.c
drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h