From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fhigh-a4-smtp.messagingengine.com (fhigh-a4-smtp.messagingengine.com [103.168.172.155]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 968EB3D9670 for ; Tue, 12 May 2026 16:58:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.155 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778605096; cv=none; b=End/d8LkBYFmwe62do6EwQXR6QcpbeJxf2WlJcPzqh0F26WpWafTTty1BcmnZpEifibXalNxHMR+WwtcaFBnFzkeR+b95FbV73wmsIo/0B35VoaLeRWXObDOs7e57MRSjRLTYtzO0YZFj7qQgMNOpH+36wbVkbiG+VJIqiR8gsc= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1778605096; c=relaxed/simple; bh=hH8xDMECW/fEhQWQl0BD0CBVVHdPha29BqTgbOfF8xo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pIkXVgqapehamczGQIXYUJqiMFtF1ZBiR1AU8a9/a2LvQX509ZeU9gzMO3Jwkm1xy6STdXY+pLNrEyKgCY0g+YMWHU2dYXEyvczFdH3jhdXgLR6SvgX+n6nh+9iFGrNJ7rZ+TSRDKDaxDWCmo4/8oIqRWiyacXPpIxpesjrWx7A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=fastmail.im; spf=pass smtp.mailfrom=fastmail.im; dkim=pass (2048-bit key) header.d=fastmail.im header.i=@fastmail.im header.b=U8TQWrBV; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=c90EFjjC; arc=none smtp.client-ip=103.168.172.155 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=fastmail.im Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=fastmail.im Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=fastmail.im header.i=@fastmail.im header.b="U8TQWrBV"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="c90EFjjC" Received: from phl-compute-04.internal (phl-compute-04.internal [10.202.2.44]) by mailfhigh.phl.internal (Postfix) with ESMTP id CB0F414000A2; Tue, 12 May 2026 12:58:13 -0400 (EDT) Received: from phl-frontend-03 ([10.202.2.162]) by phl-compute-04.internal (MEProxy); Tue, 12 May 2026 12:58:13 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.im; h= cc:cc:content-transfer-encoding:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm3; t=1778605093; x= 1778691493; bh=iBGaLdiFiGGZ2IDyp/NQ/f3pVsoq4KIs4s/fdV1SCPM=; b=U 8TQWrBV3Cmm1gCpzf6p8et9FCYW9CjtGcOProl7Njx6X0ciygQqD5pvTKD2kpva0 1gSqUxP5pJwwSkm0+1DTg6W9k4IaNGgA5/NB0ZLm0UbKRtWTEHI/aFrp7j7mTsPI ODGZQJXQianQ+Pobiuq2TH1YdcMjc6dIPNI3AXC/7y8BgfingYiKJphQxlyrDXHy Qvh8SESRKBH7vB0XyL7/sm8rrykZFUgP0DU/gwbMoAs3ieoG96T9+voSDGFzsqCy WDCV2cu4IIWetLOqkt6SpDWQ3K4cN1Lc+JRH5yafBZJTW0/lHI7n9rAksa5LaXPa MY/8x/Igc7FEPvDdHYnbA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:date:date:feedback-id:feedback-id:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to:x-me-proxy:x-me-sender :x-me-sender:x-sasl-enc; s=fm3; t=1778605093; x=1778691493; bh=i BGaLdiFiGGZ2IDyp/NQ/f3pVsoq4KIs4s/fdV1SCPM=; b=c90EFjjCCl/53vWn2 boqy1SyrbbByHZfNr+O2dAKSu1/JzPIU0v3eZjvQ8RGsbh5MX7ndfUyKkIpN8QpY rD+gd5m+GGTp2z7uDmG27Q3WY5k9Sayw8/Eh14rNQDDtr2eZSiqr2SM3zHr4JsLO r6t5hK4pJkDyUYtOy71TmpblPtIDA3Cb5TEXrsXVHTMVDHmA22aXw+ZX33V4/0bh LsOVGLNniGtV/QQs3noWJE7COxZu9coZysKKxx6Ns9YRJ7ENfUxZUA5m0UukmlWc r87ZXyYSP0ADfPEHCUv5CPUlO91osTFSm2HC2kS04qoHdbgitlSnEGistcSfBNo7 0jkZA== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefhedrtddtgdduvddvfeegucetufdoteggodetrf dotffvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfurfetoffkrfgpnffqhgenuceu rghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmnecujf gurhephffvvefufffkofgjfhgggfestdekredtredttdenucfhrhhomheptehlihgtvgcu ofhikhhithihrghnshhkrgcuoegrlhhitggvrdhkvghrnhgvlhesfhgrshhtmhgrihhlrd himheqnecuggftrfgrthhtvghrnhepteffleejfedvhfehieejlefgkeeljeevueeggeev tefhgfeuhfduffegkedvtddtnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpe hmrghilhhfrhhomheprghlihgtvgdrkhgvrhhnvghlsehfrghsthhmrghilhdrihhmpdhn sggprhgtphhtthhopedujedpmhhouggvpehsmhhtphhouhhtpdhrtghpthhtohepuggrnh hivghlsehiohhgvggrrhgsohigrdhnvghtpdhrtghpthhtohepuggrvhgvmhesuggrvhgv mhhlohhfthdrnhgvthdprhgtphhtthhopegvughumhgriigvthesghhoohhglhgvrdgtoh hmpdhrtghpthhtohepkhhusggrsehkvghrnhgvlhdrohhrghdprhgtphhtthhopehprggs vghnihesrhgvughhrghtrdgtohhmpdhrtghpthhtoheplhhutghivghnrdigihhnsehgmh grihhlrdgtohhmpdhrtghpthhtohepfihilhhlvghmuggvsghruhhijhhnrdhkvghrnhgv lhesghhmrghilhdrtghomhdprhgtphhtthhopeifihhllhgvmhgssehgohhoghhlvgdrtg homhdprhgtphhtthhopegushgrhhgvrhhnsehkvghrnhgvlhdrohhrgh X-ME-Proxy: Feedback-ID: i559e4809:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Tue, 12 May 2026 12:58:12 -0400 (EDT) From: Alice Mikityanska To: Daniel Borkmann , "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Xin Long , Willem de Bruijn , Willem de Bruijn , David Ahern , Nikolay Aleksandrov Cc: Shuah Khan , Stanislav Fomichev , Andrew Lunn , Simon Horman , Florian Westphal , netdev@vger.kernel.org, Alice Mikityanska Subject: [PATCH net-next v4 06/12] udp: Support gro_ipv4_max_size > 65536 Date: Tue, 12 May 2026 18:56:42 +0200 Message-ID: <20260512165648.386518-7-alice.kernel@fastmail.im> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260512165648.386518-1-alice.kernel@fastmail.im> References: <20260512165648.386518-1-alice.kernel@fastmail.im> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit From: Alice Mikityanska Currently, gro_max_size and gro_ipv4_max_size can be set to values bigger than 65536, and GRO will happily aggregate UDP to the configured size (for example, with TCP traffic in VXLAN tunnels). However, udp_gro_complete uses the 16-bit length field in the UDP header to store the length of the aggregated packet. It leads to the packet truncation later in __udp4_lib_rcv. Fix this by storing 0 to the UDP length field and by restoring the real length from skb->len in __udp4_lib_rcv. Signed-off-by: Alice Mikityanska Reviewed-by: Willem de Bruijn --- net/ipv4/udp.c | 5 ++++- net/ipv4/udp_offload.c | 4 ++-- net/ipv6/udp_offload.c | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c index 3e92575f1d55..856c23b9d6dd 100644 --- a/net/ipv4/udp.c +++ b/net/ipv4/udp.c @@ -2583,8 +2583,8 @@ int udp_rcv(struct sk_buff *skb) struct rtable *rt = skb_rtable(skb); struct net *net = dev_net(skb->dev); struct sock *sk = NULL; - unsigned short ulen; __be32 saddr, daddr; + unsigned int ulen; struct udphdr *uh; bool refcounted; int drop_reason; @@ -2605,6 +2605,9 @@ int udp_rcv(struct sk_buff *skb) if (ulen > skb->len) goto short_packet; + if (!ulen) + ulen = skb->len; + if (ulen < sizeof(*uh)) goto short_packet; diff --git a/net/ipv4/udp_offload.c b/net/ipv4/udp_offload.c index 22acc80b12a4..23653872ca65 100644 --- a/net/ipv4/udp_offload.c +++ b/net/ipv4/udp_offload.c @@ -916,7 +916,7 @@ int udp_gro_complete(struct sk_buff *skb, int nhoff, struct sock *sk; int err; - udp_set_len_short(uh, newlen); + udp_set_len(uh, newlen); sk = INDIRECT_CALL_INET(lookup, udp6_lib_lookup_skb, udp4_lib_lookup_skb, skb, uh->source, uh->dest); @@ -953,7 +953,7 @@ INDIRECT_CALLABLE_SCOPE int udp4_gro_complete(struct sk_buff *skb, int nhoff) /* 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_short(uh, skb->len - nhoff); + udp_set_len(uh, skb->len - nhoff); skb_shinfo(skb)->gso_type |= (SKB_GSO_FRAGLIST|SKB_GSO_UDP_L4); skb_shinfo(skb)->gso_segs = NAPI_GRO_CB(skb)->count; diff --git a/net/ipv6/udp_offload.c b/net/ipv6/udp_offload.c index c92cf5ee3e6a..7370bcb80332 100644 --- a/net/ipv6/udp_offload.c +++ b/net/ipv6/udp_offload.c @@ -171,7 +171,7 @@ int udp6_gro_complete(struct sk_buff *skb, int nhoff) /* 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_short(uh, skb->len - nhoff); + udp_set_len(uh, skb->len - nhoff); skb_shinfo(skb)->gso_type |= (SKB_GSO_FRAGLIST|SKB_GSO_UDP_L4); skb_shinfo(skb)->gso_segs = NAPI_GRO_CB(skb)->count; -- 2.54.0