diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 6b6309ec7b1b..e3990db6bdba 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -3611,8 +3611,9 @@ struct sk_buff *skb_segment(struct sk_buff *head_skb, /* GSO partial only requires that we trim off any excess that * doesn't fit into an MSS sized block, so take care of that * now. + * Cap len to not accidentally hit GSO_BY_FRAGS. */ - partial_segs = len / mss; + partial_segs = min(len, (unsigned int)(GSO_BY_FRAGS - 1)) / mss; if (partial_segs > 1) mss *= partial_segs; else