summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/linux/virtio_net.h4
-rw-r--r--net/core/skbuff.c3
2 files changed, 6 insertions, 1 deletions
diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h
index f36d21b5bc19..c381b916c1b5 100644
--- a/include/linux/virtio_net.h
+++ b/include/linux/virtio_net.h
@@ -6,6 +6,7 @@
#include <linux/ip.h>
#include <linux/ipv6.h>
#include <linux/udp.h>
+#include <net/tcp.h>
#include <uapi/linux/tcp.h>
#include <uapi/linux/virtio_net.h>
@@ -179,6 +180,9 @@ retry:
if (skb->ip_summed == CHECKSUM_PARTIAL &&
skb->csum_offset != offsetof(struct tcphdr, check))
return -EINVAL;
+
+ BUILD_BUG_ON(TCP_MIN_GSO_SIZE * GSO_MAX_SEGS < GSO_MAX_SIZE);
+ gso_size = max(gso_size, TCP_MIN_GSO_SIZE);
break;
}
diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index cbbd60455abb..966af3beed94 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -4873,7 +4873,8 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb,
* doesn't fit into an MSS sized block, so take care of that
* now.
*/
- partial_segs = len / mss;
+ DEBUG_NET_WARN_ON_ONCE(len / mss > GSO_MAX_SEGS);
+ partial_segs = min(len / mss, GSO_MAX_SEGS);
if (partial_segs > 1)
mss *= partial_segs;
else