Linux CIFS filesystem development
 help / color / mirror / Atom feed
From: netdev-bot+sashiko@kernel.org
To: lucien.xin@gmail.com
Cc: netdev@vger.kernel.org, quic@lists.linux.dev,
	davem@davemloft.net, kuba@kernel.org, edumazet@kernel.org,
	pabeni@redhat.com, horms@kernel.org, metze@samba.org,
	mbuhl@openbsd.org, tfanelli@redhat.com, hepengtao@xiaomi.com,
	dreibh@simula.no, jamie.bainbridge@gmail.com,
	linux-cifs@vger.kernel.org, pc@manguebit.org,
	linkinjeon@kernel.org, tom@talpey.com,
	kernel-tls-handshake@lists.linux.dev, cel@kernel.org,
	jlayton@kernel.org, steved@redhat.com, hare@suse.de,
	aahringo@redhat.com, dhowells@redhat.com, matttbe@kernel.org,
	mail@johnericson.me, xiyou.wangcong@gmail.com,
	alibuda@linux.alibaba.com, jbaron@akamai.com,
	illiliti@protonmail.com, sd@queasysnail.net,
	marcelo.leitner@gmail.com, daniel@haxx.se,
	andrew.gospodarek@broadcom.com, mef@scarletmail.rutgers.edu,
	paul@jakma.org, kuniyu@google.com
Subject: Re: [PATCH net-next v19 07/15] quic: add connection id management
Date: Tue, 24 Nov 2026 01:21:12 +0000	[thread overview]
Message-ID: <179548327264.3135.6491698928014688203@kernel.org> (raw)
In-Reply-To: <a0b0796446aa6da7e62134343e27abb459c3e4cf.1795393691.git.lucien.xin@gmail.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue(s) to consider.

Critical: 0 · High: 0 · Medium: 1 · Low: 0

If you believe none of the issues are legitimate, please reply to each
issue of Medium severity or higher and explain why the AI is wrong.
If any of them are legitimate and you plan to respin, please let patchwork
know by including "pw-bot: cr" as a separate line at the end of your reply
(one such reply per series is enough).

- [Medium] quic_conn_id_retire() (net/quic/connid.c) handles 'retire the
  last live consecutive CID' with `if (WARN_ON_ONCE(id_set->use_count <=…

--

quic: add connection id management

This patch adds struct quic_conn_id_set to manage source and destination
connection IDs. It provides helpers to add, retire, find and look up CIDs.
Source CIDs are also inserted into a global RCU hash table, which the RX
path uses to look up the socket.

> diff --git a/net/quic/connid.c b/net/quic/connid.c
> new file mode 100644
> index 0000000000000..1ddf8bc9b7910
> --- /dev/null
> +++ b/net/quic/connid.c
> @@ -0,0 +1,313 @@

[ ... ]

> +/* Retire a connection ID by marking it dead, then remove consecutive dead
> + * entries from the head of the list. The caller must ensure the number falls
> + * within the consecutive range [first_number, last_number].
> + */
> +void quic_conn_id_retire(struct quic_conn_id_set *id_set, u32 number)
> +{
> +	struct quic_common_conn_id *common, *tmp, *retired = NULL;
> +	struct list_head *list;
> +
> +	list = &id_set->head;
> +	list_for_each_entry(common, list, list) {
> +		if (common->number > number)
> +			break;
> +		if (common->number == number) {
> +			if (common->dead)
> +				return;
> +			retired = common;
> +			break;
> +		}
> +	}
> +
> +	if (!retired)
> +		return;
> +
> +	if (WARN_ON_ONCE(id_set->use_count <= 1))
> +		return;

[Severity: Medium]
Can a peer reach this WARN_ON_ONCE() using only its own
RETIRE_CONNECTION_ID frames?

For the source set, number comes from the peer. The v19 changelog moved
this guard below the duplicate-retire check so duplicates would not hit
the WARN, which suggests peer-chosen numbers are expected to get here.

A retired source CID that is not at the head of the list is only marked
dead. It stays on the list and stays hashed. quic_conn_id_lookup() does
not check ->dead:

	hlist_nulls_for_each_entry_rcu(s_conn_id, node, &head->head, node) {
		if (net != sock_net(s_conn_id->sk))
			continue;
		if (s_conn_id->common.id.len != len ||
		    memcmp(scid, &s_conn_id->common.id.data, len))
			continue;

Later in the series, quic_packet_get_sock() in net/quic/packet.c uses
this lookup to route the packet to the socket and set cb->seqno. It does
not check the dead flag either.

Take a source set {0, 1, 2}, all live, use_count = 3, with the peer
using CID 0:

  peer sends RETIRE(1), then RETIRE(2)
    -> use_count = 1, CIDs 1 and 2 are dead but still hashed
  no replacement CID is issued (count still includes the dead middle
  entries, so max_count or QUIC_CONN_ID_LIMIT may already be reached)
  peer sends a packet with DCID = CID 1 carrying RETIRE(0)
    -> quic_conn_id_lookup() still finds CID 1
    -> quic_conn_id_retire(id_set, 0)
    -> WARN_ON_ONCE(id_set->use_count <= 1)

RFC 9000 Section 19.16 allows RETIRE(0) in that packet, since sequence
number 0 is not the DCID of the packet carrying the frame.

On panic_on_warn systems this would be a panic the peer can trigger
remotely. Without panic_on_warn, the retirement is silently dropped.

quic_conn_id_retire() returns void, so the caller cannot tell a refused
retirement from a successful one. That means it cannot turn this case
into a PROTOCOL_VIOLATION.

Would it make sense to return an error here instead of warning? Or to
reject packets addressed to dead source CIDs?

No caller of quic_conn_id_retire() exists in this series yet. Whether
this fires depends on how the RETIRE_CONNECTION_ID handler in the
follow-up patchset checks the number before calling it.

[ ... ]

-- 
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1795393690.git.lucien.xin%40gmail.com

  reply	other threads:[~2026-11-24  1:21 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-23  0:27 [PATCH net-next v19 00/15] net: introduce QUIC infrastructure and core subcomponents Xin Long
2026-11-23  0:27 ` [PATCH net-next v19 01/15] net: define IPPROTO_QUIC and SOL_QUIC constants Xin Long
2026-11-24  1:21   ` netdev-bot+sashiko
2026-11-23  0:27 ` [PATCH net-next v19 02/15] net: build socket infrastructure for QUIC protocol Xin Long
2026-11-23  0:27 ` [PATCH net-next v19 03/15] quic: provide common utilities and data structures Xin Long
2026-11-24  1:21   ` netdev-bot+sashiko
2026-11-23  0:28 ` [PATCH net-next v19 04/15] quic: provide family ops for address and protocol Xin Long
2026-11-24  1:21   ` netdev-bot+sashiko
2026-11-23  0:28 ` [PATCH net-next v19 05/15] quic: provide quic.h header files for kernel and userspace Xin Long
2026-11-23  0:28 ` [PATCH net-next v19 06/15] quic: add stream management Xin Long
2026-11-24  1:21   ` netdev-bot+sashiko
2026-11-23  0:28 ` [PATCH net-next v19 07/15] quic: add connection id management Xin Long
2026-11-24  1:21   ` netdev-bot+sashiko [this message]
2026-11-23  0:28 ` [PATCH net-next v19 08/15] quic: add path management Xin Long
2026-11-24  1:21   ` netdev-bot+sashiko
2026-11-23  0:28 ` [PATCH net-next v19 09/15] quic: add congestion control Xin Long
2026-11-24  1:21   ` netdev-bot+sashiko
2026-11-23  0:28 ` [PATCH net-next v19 10/15] quic: add packet number space Xin Long
2026-11-23  0:28 ` [PATCH net-next v19 11/15] quic: add crypto key derivation and installation Xin Long
2026-11-24  1:21   ` netdev-bot+sashiko
2026-11-23  0:28 ` [PATCH net-next v19 12/15] quic: add crypto packet encryption and decryption Xin Long
2026-11-24  1:21   ` netdev-bot+sashiko
2026-11-23  0:28 ` [PATCH net-next v19 13/15] quic: add timer management Xin Long
2026-11-23  0:28 ` [PATCH net-next v19 14/15] quic: add packet builder base Xin Long
2026-11-23  0:28 ` [PATCH net-next v19 15/15] quic: add packet parser base Xin Long
2026-11-24  1:21   ` netdev-bot+sashiko

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=179548327264.3135.6491698928014688203@kernel.org \
    --to=netdev-bot+sashiko@kernel.org \
    --cc=aahringo@redhat.com \
    --cc=alibuda@linux.alibaba.com \
    --cc=andrew.gospodarek@broadcom.com \
    --cc=cel@kernel.org \
    --cc=daniel@haxx.se \
    --cc=davem@davemloft.net \
    --cc=dhowells@redhat.com \
    --cc=dreibh@simula.no \
    --cc=edumazet@kernel.org \
    --cc=hare@suse.de \
    --cc=hepengtao@xiaomi.com \
    --cc=horms@kernel.org \
    --cc=illiliti@protonmail.com \
    --cc=jamie.bainbridge@gmail.com \
    --cc=jbaron@akamai.com \
    --cc=jlayton@kernel.org \
    --cc=kernel-tls-handshake@lists.linux.dev \
    --cc=kuba@kernel.org \
    --cc=kuniyu@google.com \
    --cc=linkinjeon@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=lucien.xin@gmail.com \
    --cc=mail@johnericson.me \
    --cc=marcelo.leitner@gmail.com \
    --cc=matttbe@kernel.org \
    --cc=mbuhl@openbsd.org \
    --cc=mef@scarletmail.rutgers.edu \
    --cc=metze@samba.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=paul@jakma.org \
    --cc=pc@manguebit.org \
    --cc=quic@lists.linux.dev \
    --cc=sd@queasysnail.net \
    --cc=steved@redhat.com \
    --cc=tfanelli@redhat.com \
    --cc=tom@talpey.com \
    --cc=xiyou.wangcong@gmail.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