From: Vadim Fedorenko <vadfed@meta.com>
To: Leon Romanovsky <leon@kernel.org>
Cc: Aya Levin <ayal@nvidia.com>, Saeed Mahameed <saeedm@nvidia.com>,
Jakub Kicinski <kuba@kernel.org>,
"netdev@vger.kernel.org" <netdev@vger.kernel.org>
Subject: Re: [PATCH net 1/2] mlx5: fix possible ptp queue fifo overflow
Date: Mon, 23 Jan 2023 14:19:12 +0000 [thread overview]
Message-ID: <87992fa4-22c5-1af1-6d0d-f55fc3c0edb8@meta.com> (raw)
In-Reply-To: <Y841PJnZiF0WfoBn@unreal>
On 23/01/2023 07:20, Leon Romanovsky wrote:
>
> 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.
yep, sure. But I still think we would like to have small tip about
reasons. And also some other functions in mlx5 have the same debug info
with WARN_ONCE.
next prev parent reply other threads:[~2023-01-23 14:19 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
2023-01-23 14:19 ` Vadim Fedorenko [this message]
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=87992fa4-22c5-1af1-6d0d-f55fc3c0edb8@meta.com \
--to=vadfed@meta.com \
--cc=ayal@nvidia.com \
--cc=kuba@kernel.org \
--cc=leon@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=saeedm@nvidia.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 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.