All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rahul Rameshbabu <rrameshbabu@nvidia.com>
To: Vadim Fedorenko <vfedorenko@novek.ru>
Cc: Vadim Fedorenko <vadfed@fb.com>, Aya Levin <ayal@nvidia.com>,
	Saeed Mahameed <saeedm@nvidia.com>,
	Jakub Kicinski <kuba@kernel.org>, Gal Pressman <gal@nvidia.com>,
	Vadim Fedorenko <vadfed@meta.com>,
	netdev@vger.kernel.org
Subject: Re: [PATCH net v3 2/2] mlx5: fix possible ptp queue fifo use-after-free
Date: Wed, 25 Jan 2023 17:09:05 -0800	[thread overview]
Message-ID: <87lelqje4u.fsf@nvidia.com> (raw)
In-Reply-To: <20230126010206.13483-3-vfedorenko@novek.ru> (Vadim Fedorenko's message of "Thu, 26 Jan 2023 04:02:06 +0300")

On Thu, 26 Jan, 2023 04:02:06 +0300 Vadim Fedorenko <vfedorenko@novek.ru> wrote:
> From: Vadim Fedorenko <vadfed@meta.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;
>  }

  reply	other threads:[~2023-01-26  1:09 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-26  1:02 [PATCH net v3 0/2] mlx5: ptp fifo bugfixes Vadim Fedorenko
2023-01-26  1:02 ` [PATCH net v3 1/2] mlx5: fix skb leak while fifo resync and push Vadim Fedorenko
2023-01-26  6:33   ` Tariq Toukan
2023-01-26  1:02 ` [PATCH net v3 2/2] mlx5: fix possible ptp queue fifo use-after-free Vadim Fedorenko
2023-01-26  1:09   ` Rahul Rameshbabu [this message]
2023-01-26 10:53     ` Vadim Fedorenko
2023-01-26  1:27   ` Rahul Rameshbabu
2023-01-26 10:53     ` Vadim Fedorenko
2023-01-26  6:53   ` Tariq Toukan
2023-01-26 13:22     ` Vadim Fedorenko
2023-01-28 16:42   ` kernel test robot
2023-01-28 17:55   ` kernel test robot
2023-01-28 21:42   ` kernel test robot
2023-01-29  0:05   ` kernel test robot
2023-01-29 12:32   ` kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lelqje4u.fsf@nvidia.com \
    --to=rrameshbabu@nvidia.com \
    --cc=ayal@nvidia.com \
    --cc=gal@nvidia.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=saeedm@nvidia.com \
    --cc=vadfed@fb.com \
    --cc=vadfed@meta.com \
    --cc=vfedorenko@novek.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.