From: Leon Romanovsky <leon@kernel.org>
To: Vadim Fedorenko <vadfed@meta.com>
Cc: Aya Levin <ayal@nvidia.com>, Saeed Mahameed <saeedm@nvidia.com>,
Jakub Kicinski <kuba@kernel.org>,
netdev@vger.kernel.org
Subject: Re: [PATCH net 1/2] mlx5: fix possible ptp queue fifo overflow
Date: Mon, 23 Jan 2023 09:20:28 +0200 [thread overview]
Message-ID: <Y841PJnZiF0WfoBn@unreal> (raw)
In-Reply-To: <20230122161602.1958577-2-vadfed@meta.com>
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@meta.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
next prev parent reply other threads:[~2023-01-23 7:20 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-22 16:16 [PATCH net 0/2] mlx5: bugfixes for ptp fifo queue Vadim Fedorenko
2023-01-22 16:16 ` [PATCH net 1/2] mlx5: fix possible ptp queue fifo overflow Vadim Fedorenko
2023-01-23 7:20 ` Leon Romanovsky [this message]
2023-01-23 14:19 ` Vadim Fedorenko
2023-01-23 12:32 ` Gal Pressman
2023-01-23 23:49 ` Vadim Fedorenko
2023-01-23 17:24 ` Vadim Fedorenko
2023-01-24 14:39 ` Gal Pressman
2023-01-24 15:09 ` Vadim Fedorenko
2023-01-25 14:42 ` Vadim Fedorenko
2023-01-25 20:33 ` Saeed Mahameed
2023-01-25 21:24 ` Vadim Fedorenko
2023-01-22 16:16 ` [PATCH net 2/2] mlx5: fix skb leak while fifo resync Vadim Fedorenko
2023-01-23 12:38 ` Gal Pressman
2023-01-23 16:52 ` Vadim Fedorenko
2023-01-24 2:03 ` Jakub Kicinski
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=Y841PJnZiF0WfoBn@unreal \
--to=leon@kernel.org \
--cc=ayal@nvidia.com \
--cc=kuba@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=saeedm@nvidia.com \
--cc=vadfed@meta.com \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).