[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <87lelqje4u.fsf@nvidia.com>
Date: Wed, 25 Jan 2023 17:09:05 -0800
From: Rahul Rameshbabu <rrameshbabu@...dia.com>
To: Vadim Fedorenko <vfedorenko@...ek.ru>
Cc: Vadim Fedorenko <vadfed@...com>, Aya Levin <ayal@...dia.com>,
Saeed Mahameed <saeedm@...dia.com>,
Jakub Kicinski <kuba@...nel.org>,
Gal Pressman <gal@...dia.com>,
Vadim Fedorenko <vadfed@...a.com>, netdev@...r.kernel.org
Subject: Re: [PATCH net v3 2/2] mlx5: fix possible ptp queue fifo
use-after-free
On Thu, 26 Jan, 2023 04:02:06 +0300 Vadim Fedorenko <vfedorenko@...ek.ru> wrote:
> From: Vadim Fedorenko <vadfed@...a.com>
>
> diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h b/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h
> index 15a5a57b47b8..6e559b856afb 100644
> --- a/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h
> +++ b/drivers/net/ethernet/mellanox/mlx5/core/en/txrx.h
> @@ -289,14 +289,19 @@ struct sk_buff **mlx5e_skb_fifo_get(struct mlx5e_skb_fifo *fifo, u16 i)
> static inline
> 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)++);
> + struct sk_buff **skb_item;
>
> + WARN_ONCE(mlx5e_skb_fifo_has_room(fifo), "ptp fifo overflow");
I think you meant 'WARN_ONCE(!mlx5e_skb_fifo_has_room(fifo), "ptp fifo overflow");'?
It is only safe to push in the fifo when the fifo has room. Therefore,
we should warn when a push is attempted with no more room in the fifo.
Does this warning, as is, not trigger for you during testing in normal
conditions?
> + skb_item = mlx5e_skb_fifo_get(fifo, (*fifo->pc)++);
> *skb_item = skb;
> }
Powered by blists - more mailing lists