diff --git a/net/core/skbuff.c b/net/core/skbuff.c index 2b84abd60973..82be36c87eb6 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c @@ -3765,8 +3765,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, GSO_BY_FRAGS - 1U) / mss; if (partial_segs > 1) mss *= partial_segs; else