Linux Kernel Selftest development
 help / color / mirror / Atom feed
From: Andrii Pasichnyk <apasichnik9@gmail.com>
To: "Jason A . Donenfeld" <Jason@zx2c4.com>
Cc: wireguard@lists.zx2c4.com, netdev@vger.kernel.org,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S . Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@kernel.org>,
	Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
	Shuah Khan <shuah@kernel.org>,
	linux-kselftest@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH net v2 1/2] wireguard: peer: free packets left on the per-peer queues on removal
Date: Fri, 27 Nov 2026 11:59:43 +0200	[thread overview]
Message-ID: <20261127095944.17844-1-apasichnik9@gmail.com> (raw)
In-Reply-To: <179577288773.3135.10772290029017294104@kernel.org>

Sashiko AI review wrote:
> [Severity: High]
> Can this purge of peer->tx_queue run while peer->transmit_packet_work is
> still pending or running on packet_crypt_wq?

Yes, it can. An encrypt worker that the second flush waits for can queue
transmit_packet_work after that flush has started, and then nothing
waits for it. Before this patch that was harmless, because the entries
on tx_queue keep the peer alive until the worker has consumed them. The
purge breaks that.

> Would a flush_work() or cancel_work_sync() on &peer->transmit_packet_work
> before purging tx_queue close this window?

It would, but the tx_queue purge is not needed at all. The leak I
reproduced is on rx_queue only: the transmit worker has no budget and
drains everything that is ready. So v3 will drop the tx_queue purge and
free only what the disabled NAPI left on rx_queue.

As far as I can see rx_queue does not have the same window: a decrypt
worker queues no further work when it is done, it only schedules the
NAPI, and napi_disable() waits for the poll.

> [Severity: Low]
> That makes the new comment the accurate one. Should the old comment be
> updated to match?

Yes. v3 updates it and says why tx_queue is left alone.

Thanks,
Andrii

pw-bot: cr

  reply	other threads:[~2026-11-27  9:59 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-26  9:47 [PATCH net v2 0/2] wireguard: free queued packets on peer removal, and test it Andrii Pasichnyk
2026-11-26  9:47 ` [PATCH net v2 1/2] wireguard: peer: free packets left on the per-peer queues on removal Andrii Pasichnyk
2026-11-27  9:48   ` netdev-bot+sashiko
2026-11-27  9:59     ` Andrii Pasichnyk [this message]
2026-11-26  9:47 ` [PATCH net v2 2/2] wireguard: selftests: remove a peer under load Andrii Pasichnyk
2026-11-27  9:48   ` netdev-bot+sashiko
2026-11-27  9:59     ` Andrii Pasichnyk
2026-11-26  9:52 ` [PATCH net v2 0/2] wireguard: free queued packets on peer removal, and test it netdev-bot+sinfo
2026-11-27 10:22   ` Andrii Pasichnyk

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=20261127095944.17844-1-apasichnik9@gmail.com \
    --to=apasichnik9@gmail.com \
    --cc=Jason@zx2c4.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-kselftest@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=shuah@kernel.org \
    --cc=wireguard@lists.zx2c4.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