diff --git a/net/core/skbuff.c b/net/core/skbuff.c index b5f01cebbb722a7e793165f935440238d1f82bd7..f3eb95d124ed6cd0495dc887b32bef7d581259f5 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -3955,8 +3955,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