mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Fernando Fernandez Mancera <fmancera@suse.de>
To: netdev-bot+sashiko@kernel.org
Cc: netdev@vger.kernel.org, horms@kernel.org, kuba@kernel.org,
	pabeni@redhat.com, edumazet@kernel.org, davem@davemloft.net,
	johannes@sipsolutions.net, linux-wireless@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 06/16 net-next v3] ipv4: udp: split IPv4 specific logic into udp_ipv4.c
Date: Tue, 6 Oct 2026 11:12:40 +0200	[thread overview]
Message-ID: <ade9aa6a-ae47-4894-be43-2f32cc234afc@suse.de> (raw)
In-Reply-To: <179113455115.434549.17562988532168582470@kernel.org>



On 10/4/26 7:22 PM, netdev-bot+sashiko@kernel.org wrote:
> 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] When CONFIG_IPV4=n, udp4_gro_complete()
>    (net/ipv4/udp_offload.c) returns -EAFNOSUPPORT for every merged IPv4…
> 
> --
> 
> ipv4: udp: split IPv4 specific logic into udp_ipv4.c
> 
> This commit moves the IPv4-specific UDP socket code out of udp.c and into
> a new file, udp_ipv4.c. That covers lookup, input/output, multicast
> delivery and the AF_INET udp_prot. The new file is built only when
> CONFIG_IPV4 is enabled. Callers in af_inet.c, udp_bpf.c, udp_offload.c and
> ipv6/udp.c get IS_ENABLED(CONFIG_IPV4) guards.
> 
>> diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c
>> index cf07c3c6611a2..bea037d6b4eb7 100644
>> --- a/net/ipv4/udp_offload.c
>> +++ b/net/ipv4/udp_offload.c
>> @@ -958,6 +958,9 @@ INDIRECT_CALLABLE_SCOPE int udp4_gro_complete(struct sk_buff *skb, int nhoff)
>>   	const struct iphdr *iph = (struct iphdr *)(skb->data + offset);
>>   	struct udphdr *uh = (struct udphdr *)(skb->data + nhoff);
>>
>> +	if (!IS_ENABLED(CONFIG_IPV4))
>> +		return -EAFNOSUPPORT;
>> +
> 
> [Severity: Medium]
> With CONFIG_IPV4=n, can this make every merged IPv4 UDP GRO packet get
> dropped silently?
> 
> The IPv4 GRO offloads are still registered when IPv4 is disabled.
> ipv4_offload_init() in af_inet.c still calls udpv4_offload_init() and
> dev_add_offload(&net_hotdata.ip_packet_offload) with no guard. So
> inet_gro_receive()->udp4_gro_receive()->udp_gro_receive() still runs for
> IPv4 UDP packets.
> 
> The socket lookup there ends up in the new __udp4_lib_lookup() stub,
> which returns NULL. Even so, udp_gro_receive() still aggregates:
> 
> 	if (skb->dev->features & NETIF_F_GRO_FRAGLIST)
> 		NAPI_GRO_CB(skb)->is_flist = sk ? !udp_test_bit(GRO_ENABLED, sk) : 1;
> 
> 	if ((!sk && (skb->dev->features & NETIF_F_GRO_UDP_FWD)) ||
> 	    (sk && udp_test_bit(GRO_ENABLED, sk)) || NAPI_GRO_CB(skb)->is_flist)
> 		return call_gro_receive(udp_gro_receive_segment, head, skb);
> 
> At flush time, gro_complete()->inet_gro_complete()->udp4_gro_complete()
> now returns -EAFNOSUPPORT, and gro_complete() in net/core/gro.c frees
> the whole aggregate:
> 
> 	if (err) {
> 		WARN_ON(&ptype->list == head);
> 		kfree_skb(skb);
> 		return;
> 	}
> 
> The WARN_ON doesn't fire because a ptype was found, so all segments are
> lost with no warning. This would affect an IPv6-only kernel that bridges
> or forwards IPv4 UDP with NETIF_F_GRO_UDP_FWD or NETIF_F_GRO_FRAGLIST
> enabled on the ingress device. Inner IPv4 carried in IPv6 tunnels would
> be hit too.
> 
> The fraglist branch and the udp_gro_complete() path don't need IPv4
> socket state. The only IPv4-only dependency looks like the
> udp4_lib_lookup_skb reference. Would it work to stub or skip only the
> lookup, for example with a NULL-returning udp4_lib_lookup_skb when
> CONFIG_IPV4=n, and keep the rest of udp4_gro_complete()? Or should IPv4
> UDP GRO receive also be disabled in that configuration, so packets
> aren't aggregated only to be dropped at completion?
> 
> The later patch in the series, "ipv4: make CONFIG_IPV4 boolean", makes
> this configuration selectable. udp4_gro_complete() and
> ipv4_offload_init() are unchanged at the end of the series.
> 

I guess this is a good point. I will look more into it.

pw-bot: cr

>>   	/* do fraglist only if there is no outer UDP encap (or we already processed it) */
>>   	if (NAPI_GRO_CB(skb)->is_flist && !NAPI_GRO_CB(skb)->encap_mark) {
>>   		udp_set_len(uh, skb->len - nhoff);
> 
> [ ... ]
> 


  reply	other threads:[~2026-10-06  9:14 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20260930135334.4739-1-fmancera@suse.de>
2026-09-30 13:52 ` [PATCH 01/16 net-next v3] ipv4: introduce CONFIG_IPV4 to decouple the IPv4 stack Fernando Fernandez Mancera
2026-09-30 13:52 ` [PATCH 02/16 net-next v3] net: core: add IPv4 fallback stubs and guards for CONFIG_IPV4=n Fernando Fernandez Mancera
2026-10-04 17:22   ` netdev-bot+sashiko
2026-09-30 13:52 ` [PATCH 03/16 net-next v3] net: inet: relocate ip_generic_getfrag and guard IPv4 socket logic Fernando Fernandez Mancera
2026-10-04 17:22   ` netdev-bot+sashiko
2026-09-30 13:52 ` [PATCH 04/16 net-next v3] tcp: move protocol agnostic TCP functions out of tcp_ipv4.c Fernando Fernandez Mancera
2026-10-04 17:22   ` netdev-bot+sashiko
2026-09-30 13:52 ` [PATCH 05/16 net-next v3] ipv4: raw: split IPv4 specific logic into raw_ipv4.c Fernando Fernandez Mancera
2026-10-04 17:22   ` netdev-bot+sashiko
2026-09-30 13:52 ` [PATCH 06/16 net-next v3] ipv4: udp: split IPv4 specific logic into udp_ipv4.c Fernando Fernandez Mancera
2026-10-04 17:22   ` netdev-bot+sashiko
2026-10-06  9:12     ` Fernando Fernandez Mancera [this message]
2026-09-30 13:52 ` [PATCH 07/16 net-next v3] ipv4: icmp: split IPv4 specific logic into icmp_ipv4.c Fernando Fernandez Mancera
2026-10-04 17:22   ` netdev-bot+sashiko
2026-09-30 13:52 ` [PATCH 08/16 net-next v3] ipv4: ping: split IPv4 specific logic into ping_ipv4.c Fernando Fernandez Mancera
2026-09-30 13:52 ` [PATCH 09/16 net-next v3] ipv4: fib: split common nexthop logic to fib_core.c Fernando Fernandez Mancera
2026-10-04 17:22   ` netdev-bot+sashiko
2026-09-30 13:52 ` [PATCH 10/16 net-next v3] tunnels: guard IPv4 tunnel functions with CONFIG_IPV4 Fernando Fernandez Mancera
2026-09-30 13:52 ` [PATCH 11/16 net-next v3] ipv4: disable IPv4-only sysctls when CONFIG_IPV4=n Fernando Fernandez Mancera
2026-10-04 17:22   ` netdev-bot+sashiko
2026-09-30 13:52 ` [PATCH 12/16 net-next v3] netfilter: ipv4: guard ip_route_me_harder() with CONFIG_IPV4 Fernando Fernandez Mancera
2026-09-30 13:52 ` [PATCH 13/16 net-next v3] net: bridge: guard ARP/RARP proxy and suppression " Fernando Fernandez Mancera
2026-09-30 13:52 ` [PATCH 14/16 net-next v3] wifi: mac80211: replace CONFIG_INET with CONFIG_IPV4 guards Fernando Fernandez Mancera
2026-09-30 13:52 ` [PATCH 15/16 net-next v3] netlabel: cipso: introduce CONFIG_CIPSO to decouple IPv4 dependency Fernando Fernandez Mancera
2026-10-04 17:22   ` netdev-bot+sashiko
2026-09-30 13:52 ` [PATCH 16/16 net-next v3] ipv4: make CONFIG_IPV4 boolean Fernando Fernandez Mancera
2026-10-04 17:22   ` 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=ade9aa6a-ae47-4894-be43-2f32cc234afc@suse.de \
    --to=fmancera@suse.de \
    --cc=davem@davemloft.net \
    --cc=edumazet@kernel.org \
    --cc=horms@kernel.org \
    --cc=johannes@sipsolutions.net \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=netdev-bot+sashiko@kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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

all inboxes | Powered by JetHome®