🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.netdev
Article #21436

Re: [PATCH net-next v19 07/15] quic: add connection id management

#21436
From: netdev-bot+sashiko
Date: Tue, 24 Nov 2026 01:21
116 lines
12630 bytes
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
Technical Details
Message-ID: <179548327264.3135.6491698928014688203@kernel.org>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369918-linux-kernel-netdev=dewy.ru
References: <a0b0796446aa6da7e62134343e27abb459c3e4cf.1795393691.git.lucien.xin@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!news.mb-net.net!open-news-network.org!news.nntp4.net!nntp.xenet.de!news.neodome.net!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369918-linux-kernel-netdev=dewy.ru
From: netdev-bot+sashiko@kernel.org
Newsgroups: linux.kernel.netdev
Subject: Re: [PATCH net-next v19 07/15] quic: add connection id management
Date: Tue, 24 Nov 2026 01:21:12 +0000
Organization: Usenet Network
Message-ID: <179548327264.3135.6491698928014688203@kernel.org>
References: <a0b0796446aa6da7e62134343e27abb459c3e4cf.1795393691.git.lucien.xin@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="4025034"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:sUwVkJmZiF6ZTTnnKPAxpW6xH+I= sha256:scgqzOEIjcFbaSnnVuwWaG5bsX7zulDbF4EOMGGIZ7s=
	sha1:I1giLlTNenrxyBLZJd6Z2SYxQ+U= sha256:W83dFgyqEYd2ZqB/8XMAnouhUj2qAjZpPuCuicq1JXk=
List-ID: <netdev.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id 0BEB9125DC7; Tue, 24 Nov 2026 04:21:35 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -2.3
X-Spam-Status: No, score=-2.3 tagged_above=-9999 required=6.31
	tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIMWL_WL_HIGH=-0.001,
	DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1,
	DKIM_VALID_EF=-0.1, MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3,
	SPF_HELO_NONE=0.001, SPF_PASS=-0.001, URIBL_BLOCKED=0.001]
	autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=kernel.org
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id vqSrlYJxKY8F;
	Tue, 24 Nov 2026 04:21:31 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-369918-linux-kernel-netdev=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=pass (p=quarantine dis=none) header.from=kernel.org
X-Received: from tor.lore.kernel.org (tor.lore.kernel.org [172.105.105.114])
	by mail.dewy.ru (Postfix) with ESMTPS id ACB3F125DCC; Tue, 24 Nov 2026 04:21:22 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by tor.lore.kernel.org (Postfix) with ESMTP id 6247A2C25F; Tue, 24 Nov 2026 01:21:17 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1795483276;
	b=geJpKALu00ORKRxZnG+HNzeV189UKK/3HAb8dQPaM+0ytco8t1LKhIV9q/piNpAdhc+I
	 Rhs3hXslB2iQUPwAicwjYYzAaFx+9FB6H4xv3dxWVDsJmRKNW4Js57nz3ORFWYxnveb7Q
	 wLuN4Zl5CF+J6E01CZUOx6pEjzhcCdD668EpwwEsBlCjrqUzTWCndw/HPLbfRpk+5mV/m
	 1u2JVOsWHmrOq5jdIFHFP5YJnfuUPRROsVptkHK2/Hwnopa+REyE7/UIi73x0+MLDVPFR
	 eJtpn+0HuLCYNlivaCqik6VbGoBPejPH01I10auFcPt+s7TygvY8G9N0hFMG0oFL0LA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795483276;
	h=X-Original-To:Received:Received:DKIM-Signature:Subject:From:To:Cc:
	 Date:Message-ID:In-Reply-To:References:X-sashiko-severity:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version;
	bh=7BxqU8scciUBPlVCv6kfp0HrjxqNHAp0nu+Z1dMs47Q=;
	b=wVK+mejN2QOC5ucVNtQseztBhRTJnKEI7iwtl6r1z8wTcZo7lyGLhCqoUlEvm1B+Lp/D
	 eSoDM14yfd35dhnCpAB6iHnaoiRerT50+sOrfMYXo4WGtYFyTFsFPdJOFYQsr77I5NoUR
	 4k5i5K9A2u1uyF+wx+I0+LFDhH+PonvPgOnWyherys2uLXPnfLWqHSkfWXJWJz9URY3im
	 N+Yu4cE2irwUX6oPkQGIuQr6cmDtjoqjrxNycCdSiJhXhB8BIi4mjZUdXABAeEfMCY0pH
	 wt4ZawccjOJuRvcWC4UuAAZcwMemyAVV0GdmgBbG+9ilYzqVqkHS9/2Ca9cifsKCGkw==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XYltFTcd;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id 97F3C606A32A;
	Tue, 24 Nov 2026 01:21:16 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XYltFTcd
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1795483275;
	b=fSUBm5UJgpOphPWokRMFahjPKLEw8wloSWCEXhs3rcJXleijxeW1GcSF93+LKWoexw5E
	 zDW1clmWgf3WOAm8/K3Gk8nUbTS1klkC/ut4x8kKRepNmFvu1XwtVmru8SIaG2OQatkpf
	 iWUiPcMo68IGa0BXXPHDT6VYR7II6sQdDOkDo+rUn2DoJ71SR/21vNaALHU+WjW10K8TB
	 qDfZyS4S2jmPYmUsH0L1J/xvU/gjqek/fq3qJjfMJMlduydYAMu3wK7CDQ1vUCNA1F0HW
	 teXV59ndGwXrRs3ZcbX4IeUN4xdV9nyoVXxWCWa0TH4nBjuXXo31QdPQANdaHb4K5ng==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1795483275;
	h=Received:DKIM-Signature:Subject:From:To:Cc:Date:Message-ID:
	 In-Reply-To:References:X-sashiko-severity:Content-Type:
	 Content-Transfer-Encoding:MIME-Version;
	bh=7BxqU8scciUBPlVCv6kfp0HrjxqNHAp0nu+Z1dMs47Q=;
	b=QZzaQHANqni0/yF6h6DCTMomI5GVCELS77TK2FFb4h8Hbng6GNpYFyV7/7lPWGU6pipA
	 3RgmY5KBupZchLnkMu49UXxFC/Hz0qdWTT4iJilRLNKL6+otgmbUuAdP0DpbVb2+01K8F
	 r7aQM4DOnRArB3c/daJ8ie7f0tvUKPOM6dda8x1JIFD/Ga7EgFzaheWhKLcwKj0Sd+sbW
	 +uVl18Bmb1Be0m8EMXmSHVsmVj2ZXPZZGiaMGTkaGsHR5Fucm9Prv8BvKy+F0eSP3sXG6
	 2x9iSGZDQqaTTDHHnuggUI9NQQ0t3MXjIWIEQc1UvmFJWb9WOt8lMi4/peWtZb53HjQ==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=XYltFTcd;
	arc=none smtp.remote-ip=100.103.45.18
X-Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18])
	(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1))
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id B9C49606A321;
	Tue, 24 Nov 2026 01:21:15 +0000 (UTC)
X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 1B7261F000CF;
	Tue, 24 Nov 2026 01:21:13 +0000 (UTC)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org;
	s=k20260515; t=1795483275;
	bh=7BxqU8scciUBPlVCv6kfp0HrjxqNHAp0nu+Z1dMs47Q=;
	h=Subject:From:To:Cc:Date:In-Reply-To:References;
	b=XYltFTcdnj4KUOr9OmoQ9oABFYaMWVxGNR6r3cGPjfnGq13/JFq2uMH7Tf1ScK72/
	 b6oInXa2z9HZnLBrfMTvLwgYZJM3WxktGM+KSBzzvTYiaSJ3lBsUjntul6AsyQ5oxT
	 jLioRVygZFw/Sd6FqOggYuxYgvI6lRuW/QXd+bceMSB4CrxfHEKpslz8iPAdj0gWDF
	 ZGluJ2nXRVgz09QGVMvNH0qSc3TqR6YDFE4bJCW8mI/cWjo7pGVOD5rI/JDcx2wUGE
	 iZSOHIuvA/zw6WUEBJsqTqcarDRxQoyNCoB4xy24Z8j8dKUj/Dar/b2jJfs9TWz+Dp
	 BizllNrn5tiRg==
X-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
X-In-Reply-To: <a0b0796446aa6da7e62134343e27abb459c3e4cf.1795393691.git.lucien.xin@gmail.com>
X-sashiko-severity: Medium
X-Mailing-List: netdev@vger.kernel.org
X-List-Post: <mailto:netdev@vger.kernel.org>
X-List-Help: <mailto:netdev+help@vger.kernel.org>
X-List-Subscribe: <mailto:netdev+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:netdev+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:netdev+owner@vger.kernel.org>
X-Precedence: list