Article View: linux.kernel.netdev
Article #21433Re: [PATCH net-next v19 04/15] quic: provide family ops for address and protocol
From: netdev-bot+sashiko
Date: Tue, 24 Nov 2026 01:21
Date: Tue, 24 Nov 2026 01:21
206 lines
16031 bytes
16031 bytes
Thank you for your contribution! Sashiko AI review found 4 potential
issue(s) to consider.
Critical: 0 · High: 0 · Medium: 3 · Low: 1
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_flow_route() in net/quic/family.c returns -EINVAL
whenever `sa->sa.sa_family` is non-zero and differs from…
- [Medium] quic_v4_flow_route() in net/quic/family.c accepts any route
returned by ip_route_output_flow() and passes it straight to…
- [Medium] When the selected IPv6 source is link-local,
quic_v6_flow_route() in net/quic/family.c runs `sa->v6.sin6_scope_id =…
- [Low] The commit message does not mention three user-visible behaviour
changes.
--
quic: provide family ops for address and protocol
This patch adds net/quic/family.{c,h} with IPv4/IPv6 helpers for routing,
transmit, address parsing and comparison, and UDP tunnel socket
configuration. It also wires quic_inet_getname(), quic_setsockopt() and
quic_getsockopt() to these helpers.
> quic: provide family ops for address and protocol
>
> Introduce QUIC address and protocol family operations to handle IPv4/IPv6
> specifics consistently. The new family.{c,h} provide helpers for routing,
> skb transmit handling, address parsing and comparison and UDP socket config
> initializing etc.
[Severity: Low]
This isn't a bug, but the commit message describes only internal helpers.
The patch also changes user-visible behaviour on QUIC sockets.
quic_inet_getname() used to return -EOPNOTSUPP. It now calls
quic_get_sk_addr(), so getsockname() and getpeername() return real
addresses through inet_getname() or inet6_getname().
quic_setsockopt() and quic_getsockopt() used to return -EOPNOTSUPP for any
level other than SOL_QUIC. They now pass the call to ip_setsockopt() or
ipv6_setsockopt(), and to ip_getsockopt() or ipv6_getsockopt(). With
CONFIG_NETFILTER the call can also reach nf_setsockopt() or
nf_getsockopt(). For unknown levels the error changes from -EOPNOTSUPP to
-ENOPROTOOPT.
SOL_IP and SOL_IPV6 options set this way change state that the new helpers
read: inet_sk(sk)->tos, uc_ttl, np->tclass, SNDFLOW and ipv6_only_sock().
Could the commit message mention these changes? The subject also still
says "family ops", but v3 replaced the ops abstraction with if/else
helpers.
> diff --git a/net/quic/family.c b/net/quic/family.c
> new file mode 100644
> index 0000000000000..73f3b955e13c4
> --- /dev/null
> +++ b/net/quic/family.c
[ ... ]
> +static int quic_v4_flow_route(struct sock *sk, union quic_addr *da,
> + union quic_addr *sa, struct flowi *fl)
> +{
[ ... ]
> + security_sk_classify_flow(sk, flowi4_to_flowi_common(fl4));
> + rt = ip_route_output_flow(sock_net(sk), fl4, sk);
> + if (IS_ERR(rt))
> + return PTR_ERR(rt);
> +
> + if (quic_v4_is_any_addr(sa)) {
> + sa->v4.sin_family = AF_INET;
> + sa->v4.sin_addr.s_addr = fl4->saddr;
> + }
> + sk_setup_caps(sk, &rt->dst);
[Severity: Medium]
Should quic_v4_flow_route() reject RTCF_BROADCAST and RTCF_MULTICAST
routes before caching the dst?
Other IPv4 socket types check rt->rt_flags at this point. For example,
__ip4_datagram_connect() does:
if ((rt->rt_flags & RTCF_BROADCAST) && !sock_flag(sk, SOCK_BROADCAST)) {
ip_rt_put(rt);
err = -EACCES;
goto out;
}
raw_sendmsg() has the same check. tcp_v4_connect() returns -ENETUNREACH
for both RTCF_MULTICAST and RTCF_BROADCAST.
Without such a check, a QUIC socket can cache and send on a broadcast
route (255.255.255.255 or a subnet-directed broadcast) without
SO_BROADCAST.
On the server side, the reply destination comes from the source address
of a received packet. With rp_filter=0, the kernel default, a spoofed
source equal to the local subnet broadcast (e.g. 192.168.1.255) gets past
ip_route_input_slow() and fib_validate_source().
Would the server's replies then go out as link-layer broadcasts to every
host on the LAN? That multiplies the 3x anti-amplification budget by the
number of hosts. A userspace QUIC server on a UDP socket would get -EACCES
from sendto() in this case.
> + return 0;
> +}
> +
> +static int quic_v6_flow_route(struct sock *sk, union quic_addr *da,
> + union quic_addr *sa, struct flowi *fl)
> +{
[ ... ]
> + dst = ip6_dst_lookup_flow(sock_net(sk), sk, fl6, NULL);
> + if (IS_ERR(dst))
> + return PTR_ERR(dst);
> +
> + if (quic_v6_is_any_addr(sa)) {
> + sa->v6.sin6_family = AF_INET6;
> + sa->v6.sin6_addr = fl6->saddr;
> + if ((ipv6_addr_type(&fl6->saddr) & IPV6_ADDR_LINKLOCAL))
> + sa->v6.sin6_scope_id = dst->dev->ifindex;
[Severity: Medium]
Is it safe to dereference dst->dev here without rcu_read_lock()?
This code runs in preemptible process context, under lock_sock() through
quic_packet_route(). A dst reference does not pin the original
net_device. On unregister, dst_dev_put() does:
rcu_assign_pointer(dst->dev_rcu, blackhole_netdev);
netdev_ref_replace(dev, blackhole_netdev, &dst->dev_tracker,
GFP_ATOMIC);
That drops the reference on the old device. This reader is not inside an
RCU read-side section, so the synchronize_net() calls during unregister
do not wait for it.
If the task is preempted after loading dst->dev but before reading
->ifindex, can it read freed net_device memory? Even in the harmless
case, it could store blackhole_netdev's ifindex as the scope ID.
include/net/dst.h provides dst_dev() and dst_dev_rcu() for this.
sk_setup_caps() on the IPv4 path reads the device through dst_dev_rcu()
under rcu_read_lock().
> + }
> + ip6_dst_store(sk, dst, false, false);
> + return 0;
> +}
[ ... ]
> +int quic_flow_route(struct sock *sk, union quic_addr *da, union quic_addr *sa,
> + struct flowi *fl)
> +{
> + if (sa->sa.sa_family && da->sa.sa_family != sa->sa.sa_family)
> + return -EINVAL;
[Severity: Medium]
Does this check reject a valid dual-stack setup?
An AF_INET6 '::' source (a socket bound to the IPv6 wildcard) with an
AF_INET destination fails here. quic_v6_cmp_sk_addr() accepts that same
pairing on receive:
if (a->sa.sa_family != addr->sa.sa_family) {
if (ipv6_only_sock(sk) || a->sa.sa_family == AF_INET)
return false;
return quic_is_any_addr(a);
}
So a stored AF_INET6 '::' address matches AF_INET traffic on receive, but
routing refuses the same combination on transmit.
Suppose the later bind() and connect() code stores a bound [::] source
as-is. Would a client bound to [::]:port that connects to an IPv4 peer
then fail in quic_packet_route()->quic_flow_route() with -EINVAL? The v14
changelog says IPv4-mapped addresses are converted to AF_INET, so the
peer address would arrive here as AF_INET. Plain UDP allows this on a
dual-stack socket.
Dropping the check alone would not fix it. quic_v4_flow_route() reads
sa->v4.sin_addr, which overlays sin6_flowinfo, so an IPv6-wildcard sa
would need to be treated as IPv4 ANY.
The v15 changelog shows the family mismatch check is intentional. Was the
dual-stack wildcard case considered?
> +
> + return quic_af_ipv4(da) ? quic_v4_flow_route(sk, da, sa, fl) :
> + quic_v6_flow_route(sk, da, sa, fl);
> +}
--
Sashiko AI review · https://netdev-ai.bots.linux.dev/sashiko/#/patchset/cover.1795393690.git.lucien.xin%40gmail.com
Technical Details
Message-ID:
<179548326686.3135.1885327270671072036@kernel.org>Path:
mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369916-linux-kernel-netdev=dewy.ruReferences:
<e33f69fbe24e60c4f624c08279553be2888558ff.1795393691.git.lucien.xin@gmail.com>Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-can.pugleaf.net!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!netdev+bounces-369916-linux-kernel-netdev=dewy.ru From: netdev-bot+sashiko@kernel.org Newsgroups: linux.kernel.netdev Subject: Re: [PATCH net-next v19 04/15] quic: provide family ops for address and protocol Date: Tue, 24 Nov 2026 01:21:06 +0000 Organization: Usenet Network Message-ID: <179548326686.3135.1885327270671072036@kernel.org> References: <e33f69fbe24e60c4f624c08279553be2888558ff.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="4024880"; mail-complaints-to="abuse@usenet.network" Cancel-Lock: sha1:0hjYXmI5iX6TGooIpG9dfwCfhB8= sha256:6kPN5v+gqrPAw92DEpyTWtswDOAJQ8A1lOWo4mNUdVg= sha1:qhd1Y22yLZYDXN7dWneE/zBY11E= sha256:SWwsRxeEiUnUEkUa4zosrN5xKuk+L6+Vybsh5OWjfzM= 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 03B72125DC7; Tue, 24 Nov 2026 04:21:27 +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 9wT5zQWWid4P; Tue, 24 Nov 2026 04:21:23 +0300 (MSK) X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.105.105.114; helo=tor.lore.kernel.org; envelope-from=netdev+bounces-369916-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 069EA125DCA; Tue, 24 Nov 2026 04:21:14 +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 3EF332C929; Tue, 24 Nov 2026 01:21:11 +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=1795483270; b=UQy/MCEPbeJhm88wN2Jx0JDl8FVpjJ+4JESVu0zy97I8B3eqHHASWUm9N0tcbfG4Q/nk nKbuLALnKBycjcdB5dUKR1QV1UHKKvAYiSHMFyKkLdgW5OOY6sD6lh3mWEK+cA7WwaWcf Q5vvUVQxBNM+BPsK1iXfI0qlkCDj41Qrv+G6Tu2xu9XemPym/HcFpHuXcDEZyoT0ihg70 pcr4vPNmxL57ukXJ7ETDVqLuWa+KUYxdpnQlStottBKiBsnosyTJFzyQO2Osz7ICN6cvD x8sZ4ErvsNjXD7kA1tPzddEWULoZqi6s5n6g9Ugjgl29dIppMB7ox4sazkCMaseMNVQ== X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795483270; 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=lsgJbmq9xKAEYd+A+T8Qq8tXEzdvo3g7s2dCZbJ+4cg=; b=R6hpqbXBDcWJB1NGq4Xo4iUmZaJHo5BAj+RFA9+LMci72o4M/5WO06/VH7MpiSwo8FMc Gz4slgD5VaZzi6RkpDywHNWyP8jmtz0Xs15ZZ1awOzlBjnqviA6EYkZYGh4Icx1li93XD H1xqi+FfODJjVgAaV6ORvYPikHY0oyjSnzmqsf9dDrSSU0dhYP3HEflZvM8ddyF5JqaMy 9fIHdJ3ZkucyxOJIeSuSs94nhU246GHCtUtxYlSjtQ0EWq/CJOS/JvlWTVmnolB0KrjM9 d80i6VlIyfZPsDeGBrkJJoZewtzd/K9fiouUGYHTvBhcuHbgbJm9qBHn6VMvQTwXi9w== 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=JceiwOb6; 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 B3851606A335; Tue, 24 Nov 2026 01:21:10 +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=JceiwOb6 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=1795483269; b=fOPEpAJhO2xTXo2Dj1pMNrEeeFXouErKNkiDvSToNhO0asoUYEB0CxJ5Mj4JwlD4vQv7 dRmmdj1MqrZJOKxXomHIP8azHo/HuNv9fzb/IRiJaVtRKmU5+EkmKIIJ9QH0mHZODoUnR zOQAKMNY9OEM8YAeFR8z8B5t59Fwymf5/0c4nPlhM1+cYbsUPdmLtCC0ZEaNKdfEHHiU0 NlN/nm10HeHyuABDId4hC34ToagyZRSyK671XaRoqRrGAIv9VH3qou2wKsbMvu/0qZjNa tJ37ObCpqQBdwW95IM79UAg+YZbwhG1qYWpj7+1XNhZ7LDZvJItYQoy7S5g5cCB177Q== X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1795483269; 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=lsgJbmq9xKAEYd+A+T8Qq8tXEzdvo3g7s2dCZbJ+4cg=; b=M0boh1ZOhnumx2T6keKBM9x4HagrUd3PV20PA6Bi93vU4Ph1q2w9xMX5XQtFOTsRtca2 Sxk/LB1Mvg/uOYY3uZrvL2Qg7Xw3Apro/yiAG42v44xWRDPAFBdVMzdczidUkLLNM43zE lbW6xzYeg22CZYD7oqd8WmTtE0bA1wXnund4b+og4V2JqnUIG3w1Mo1vPKHPClJk111XR oRJijBDfBSSsTWnd9bjaG7tXxShtDypCXMUWsBULGg0ojF9ZBl+BKRR4sycmBoLsu35np ka86KeV97uWgIl91rdj2l40GA303Y5T++G2TheMwWOO97JeMbW739odCvphT+90/hNQ== 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=JceiwOb6; 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 D014F606A321; Tue, 24 Nov 2026 01:21:09 +0000 (UTC) X-Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4DC1B1F000D1; Tue, 24 Nov 2026 01:21:07 +0000 (UTC) X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1795483269; bh=lsgJbmq9xKAEYd+A+T8Qq8tXEzdvo3g7s2dCZbJ+4cg=; h=Subject:From:To:Cc:Date:In-Reply-To:References; b=JceiwOb6FS71vK1l84Mwo8qnobrgFQPAPGgPk21Mk+dCRVUdDN03P/X66qyO1HFxc /zOQEqLCDYcq1gTmQAIpJxHqj7dJV8cCEGwcWjdR52hDJeKgOaXLsuGHeBHLUMS9l2 lTS/8KVb5Im9s1tVWkbpCzPOiSP48hi/jk//pl7SJGQOwkTzZKJ1sOSsk1OTxz9cmi qyDRH5m0DwkHzPb/qaBDhQLLrheDB6EC4f4deD1/GXxc1ln4qC/rh7auasqVKqcH7C t9qDJx3aaQT3lkvpAwhuiP5LHbG/RLHNvPOPCpHme8O1ysHQBLVHSB+OYgvQTJX5LF FmxR5tIMPU9lg== 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: <e33f69fbe24e60c4f624c08279553be2888558ff.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