[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Y841PJnZiF0WfoBn@unreal>
Date: Mon, 23 Jan 2023 09:20:28 +0200
From: Leon Romanovsky <leon@...nel.org>
To: Vadim Fedorenko <vadfed@...a.com>
Cc: Aya Levin <ayal@...dia.com>, Saeed Mahameed <saeedm@...dia.com>,
Jakub Kicinski <kuba@...nel.org>, netdev@...r.kernel.org
Subject: Re: [PATCH net 1/2] mlx5: fix possible ptp queue fifo overflow
On Sun, Jan 22, 2023 at 08:16:01AM -0800, Vadim Fedorenko wrote:
> Fifo pointers are not checked for overflow and this could potentially
> lead to overflow and double free under heavy PTP traffic.
>
> Also there were accidental OOO cqe which lead to absolutely broken fifo.
> Add checks to workaround OOO cqe and add counters to show the amount of
> such events.
>
> Fixes: 19b43a432e3e ("net/mlx5e: Extend SKB room check to include PTP-SQ")
> Signed-off-by: Vadim Fedorenko <vadfed@...a.com>
> ---
> .../net/ethernet/mellanox/mlx5/core/en/ptp.c | 28 ++++++++++++++-----
> .../net/ethernet/mellanox/mlx5/core/en/txrx.h | 6 +++-
> .../ethernet/mellanox/mlx5/core/en_stats.c | 2 ++
> .../ethernet/mellanox/mlx5/core/en_stats.h | 2 ++
> 4 files changed, 30 insertions(+), 8 deletions(-)
<...>
> @@ -291,12 +291,16 @@ void mlx5e_skb_fifo_push(struct mlx5e_skb_fifo *fifo, struct sk_buff *skb)
> {
> struct sk_buff **skb_item = mlx5e_skb_fifo_get(fifo, (*fifo->pc)++);
>
> + WARN_ONCE((u16)(*fifo->pc - *fifo->cc) > fifo->mask, "%s overflow", __func__);
nit, ""%s overflow", __func__" is not needed as call trace already includes function name.
Thanks
Powered by blists - more mailing lists