]> git.baikalelectronics.ru Git - kernel.git/commitdiff
udp: using datalen to cap max gso segments
authorJianguo Wu <wujianguo@chinatelecom.cn>
Wed, 8 Dec 2021 10:03:33 +0000 (18:03 +0800)
committerJakub Kicinski <kuba@kernel.org>
Thu, 9 Dec 2021 15:48:07 +0000 (07:48 -0800)
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>
Link: https://lore.kernel.org/r/900742e5-81fb-30dc-6e0b-375c6cdd7982@163.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv4/udp.c

index 8bcecdd6aeda8f6af5ba541138082fdc1ef59c93..23b05e28490b0a0a690a837027f26167e353f8ce 100644 (file)
@@ -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;
                }