Skip to content

Commit

Permalink
tcp: Increase TCP_MAXSEG socket option minimum.
Browse files Browse the repository at this point in the history
As noted by Steve Chen, since commit
f5fff5d ("tcp: advertise MSS
requested by user") we can end up with a situation where
tcp_select_initial_window() does a divide by a zero (or
even negative) mss value.

The problem is that sometimes we effectively subtract
TCPOLEN_TSTAMP_ALIGNED and/or TCPOLEN_MD5SIG_ALIGNED from the mss.

Fix this by increasing the minimum from 8 to 64.

Reported-by: Steve Chen <schen@mvista.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
David S. Miller committed Nov 11, 2010
1 parent 8d987e5 commit 7a1abd0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion net/ipv4/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2246,7 +2246,7 @@ static int do_tcp_setsockopt(struct sock *sk, int level,
/* Values greater than interface MTU won't take effect. However
* at the point when this call is done we typically don't yet
* know which interface is going to be used */
if (val < 8 || val > MAX_TCP_WINDOW) {
if (val < 64 || val > MAX_TCP_WINDOW) {
err = -EINVAL;
break;
}
Expand Down

0 comments on commit 7a1abd0

Please sign in to comment.