Skip to contentSkip to conversation

udp: using datalen to cap max gso segments

PATCH Applied Jianguo Wu 3 participants 3 messages Dec 8, 2021 – Dec 9, 2021

Subsystems (3)
lore
Share & tools
lore

Jianguo Wu

author
#0 lore raw

PATCH 1/1 udp: using datalen to cap max gso segments

From: Jianguo Wu <[email protected]>

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")
---
 net/ipv4/udp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
net/ipv4/udp.c +1 -1
index 8bcecdd6aeda..23b05e28490b 100644
@@ -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;
 		}
Signature · 1 line
1.8.3.1
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 11 lines · Jianguo Wu

From: Jianguo Wu <[email protected]>

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;
    }
Quoted 5 lines

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

Fixes bec1f6f69736 ("udp: generate gso with UDP_SEGMENT")

Thanks Jianguo

#2 lore raw
In reply to Jianguo Wu
This patch was applied to netdev/net.git (master) by Jakub Kicinski <[email protected]>:

Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <[email protected]>:

Quoted 11 lines · On Wed, 8 Dec 2021 18:03:33 +0800 you wrote:

From: Jianguo Wu <[email protected]>

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!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html