netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: Vadim Fedorenko <vadfed@meta.com>
Cc: Vadim Fedorenko <vadim.fedorenko@linux.dev>,
	Rahul Rameshbabu <rrameshbabu@nvidia.com>,
	"Tariq Toukan" <ttoukan.linux@gmail.com>,
	Gal Pressman <gal@nvidia.com>,
	"Saeed Mahameed" <saeed@kernel.org>, <netdev@vger.kernel.org>
Subject: Re: [PATCH net v4 2/2] mlx5: fix possible ptp queue fifo use-after-free
Date: Wed, 1 Feb 2023 19:08:01 -0800	[thread overview]
Message-ID: <20230201190801.5082bb49@kernel.org> (raw)
In-Reply-To: <20230201122605.1350664-3-vadfed@meta.com>

On Wed, 1 Feb 2023 04:26:05 -0800 Vadim Fedorenko wrote:
> +	if (skb_cc > skb_id || PTP_WQE_CTR2IDX(ptpsq->skb_fifo_pc) < skb_id) {

FWIW I still can't understand why this is correct. If we lose ts for
the last elem before wrap we'll see something like (assume wrap at 256
for easier math):

  cc: 255  pc: 2    skb_id: 0   => cc > skb_id, OOO, drop
  cc: 255  pc: 2    skb_id: 1   => cc > skb_id, OOO, drop
  cc: 255  pc: 3 // produce 
  cc: 255  pc: 3    skb_id: 2   => cc > skb_id, OOO, drop
  cc: 255  pc: 4 // produce
  cc: 255  pc: 4    skb_id: 3   => cc > skb_id, OOO, drop

No?

  parent reply	other threads:[~2023-02-02  3:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-01 12:26 [PATCH net v4 0/2] mlx5: ptp fifo bugfixes Vadim Fedorenko
2023-02-01 12:26 ` [PATCH net v4 1/2] mlx5: fix skb leak while fifo resync and push Vadim Fedorenko
2023-02-01 12:26 ` [PATCH net v4 2/2] mlx5: fix possible ptp queue fifo use-after-free Vadim Fedorenko
2023-02-01 18:19   ` Saeed Mahameed
2023-02-01 21:36     ` Vadim Fedorenko
2023-02-01 23:40       ` Saeed Mahameed
2023-02-02  1:34         ` Vadim Fedorenko
2023-02-02  3:01         ` Jakub Kicinski
2023-02-02  3:08   ` Jakub Kicinski [this message]
2023-02-02 11:48     ` Vadim Fedorenko

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=20230201190801.5082bb49@kernel.org \
    --to=kuba@kernel.org \
    --cc=gal@nvidia.com \
    --cc=netdev@vger.kernel.org \
    --cc=rrameshbabu@nvidia.com \
    --cc=saeed@kernel.org \
    --cc=ttoukan.linux@gmail.com \
    --cc=vadfed@meta.com \
    --cc=vadim.fedorenko@linux.dev \
    /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).