[PATCH] udp: using datalen to cap max gso segments

Subsystems: networking [general], the rest, user datagram protocol (udp)

STALE1761d LANDED

Landed in mainline as 158390e45612 on 2021-12-09.

3 messages, 3 authors, 2021-12-09 · open the first message on its own page

[PATCH] udp: using datalen to cap max gso segments

From: Jianguo Wu <hidden>
Date: 2021-12-08 10:19:14

From: Jianguo Wu <redacted>

The max number of UDP gso segments is intended to cap to UDP_MAX_SEGMENTS,
this is checked in udp_send_skb():

    if (skb->len > cork->gso_size * UDP_MAX_SEGMENTS) {
        kfree_skb(skb);
        return -EINVAL;
    }

skb->len contains network and transport header len here, we should use
only data len instead.

Fixes: bec1f6f69736 ("udp: generate gso with UDP_SEGMENT")
Signed-off-by: Jianguo Wu <redacted>
---
 net/ipv4/udp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/ipv4/udp.c b/net/ipv4/udp.c
index 8bcecdd6aeda..23b05e28490b 100644
--- a/net/ipv4/udp.c
+++ b/net/ipv4/udp.c
@@ -916,7 +916,7 @@ static int udp_send_skb(struct sk_buff *skb, struct flowi4 *fl4,
 			kfree_skb(skb);
 			return -EINVAL;
 		}
-		if (skb->len > cork->gso_size * UDP_MAX_SEGMENTS) {
+		if (datalen > cork->gso_size * UDP_MAX_SEGMENTS) {
 			kfree_skb(skb);
 			return -EINVAL;
 		}
-- 
1.8.3.1

Re: [PATCH] udp: using datalen to cap max gso segments

From: Willem de Bruijn <willemdebruijn.kernel@gmail.com>
Date: 2021-12-08 14:59:09

On Wed, Dec 8, 2021 at 5:03 AM Jianguo Wu [off-list ref] wrote:
From: Jianguo Wu <redacted>

The max number of UDP gso segments is intended to cap to UDP_MAX_SEGMENTS,
this is checked in udp_send_skb():

    if (skb->len > cork->gso_size * UDP_MAX_SEGMENTS) {
        kfree_skb(skb);
        return -EINVAL;
    }

skb->len contains network and transport header len here, we should use
only data len instead.

Fixes: bec1f6f69736 ("udp: generate gso with UDP_SEGMENT")
Signed-off-by: Jianguo Wu <redacted>
Reviewed-by: Willem de Bruijn <willemb@google.com>

Thanks Jianguo

Re: [PATCH] udp: using datalen to cap max gso segments

From: patchwork-bot+netdevbpf@kernel.org
Date: 2021-12-09 16:00:13

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski [off-list ref]:

On Wed, 8 Dec 2021 18:03:33 +0800 you wrote:
From: Jianguo Wu <redacted>

The max number of UDP gso segments is intended to cap to UDP_MAX_SEGMENTS,
this is checked in udp_send_skb():

    if (skb->len > cork->gso_size * UDP_MAX_SEGMENTS) {
        kfree_skb(skb);
        return -EINVAL;
    }

[...]
Here is the summary with links:
  - udp: using datalen to cap max gso segments
    https://git.kernel.org/netdev/net/c/158390e45612

You are awesome, thank you!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html

Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help