diff mbox series

udp: using datalen to cap max gso segments

Message ID 900742e5-81fb-30dc-6e0b-375c6cdd7982@163.com (mailing list archive)
State Accepted
Commit 158390e45612ef0fde160af0826f1740c36daf21
Delegated to: Netdev Maintainers
Headers show
Series udp: using datalen to cap max gso segments | expand

Checks

Context Check Description
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix warning Target tree name not specified in the subject
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/cc_maintainers warning 3 maintainers not CCed: yoshfuji@linux-ipv6.org dsahern@kernel.org kuba@kernel.org
netdev/build_clang success Errors and warnings before: 20 this patch: 20
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success Fixes tag looks correct
netdev/build_allmodconfig_warn success Errors and warnings before: 10 this patch: 10
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Jianguo Wu Dec. 8, 2021, 10:03 a.m. UTC
From: Jianguo Wu <wujianguo@chinatelecom.cn>

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 <wujianguo@chinatelecom.cn>
---
 net/ipv4/udp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Willem de Bruijn Dec. 8, 2021, 2:58 p.m. UTC | #1
On Wed, Dec 8, 2021 at 5:03 AM Jianguo Wu <wujianguo106@163.com> wrote:
>
> From: Jianguo Wu <wujianguo@chinatelecom.cn>
>
> 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 <wujianguo@chinatelecom.cn>

Reviewed-by: Willem de Bruijn <willemb@google.com>

Thanks Jianguo
patchwork-bot+netdevbpf@kernel.org Dec. 9, 2021, 4 p.m. UTC | #2
Hello:

This patch was applied to netdev/net.git (master)
by Jakub Kicinski <kuba@kernel.org>:

On Wed, 8 Dec 2021 18:03:33 +0800 you wrote:
> From: Jianguo Wu <wujianguo@chinatelecom.cn>
> 
> 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!
diff mbox series

Patch

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;
 		}