]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
tcp: Increase TCP_MAXSEG socket option minimum.
authorDavid S. Miller <davem@davemloft.net>
Thu, 11 Nov 2010 05:35:37 +0000 (21:35 -0800)
committerWilly Tarreau <w@1wt.eu>
Sat, 30 Apr 2011 14:53:05 +0000 (16:53 +0200)
commit 7a1abd08d52fdeddb3e9a5a33f2f15cc6a5674d2 upstream.

As noted by Steve Chen, since commit
f5fff5dc8a7a3f395b0525c02ba92c95d42b7390 ("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>
Cc: Moritz Muehlenhoff <jmm@debian.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
net/ipv4/tcp.c

index dc2caaf5e162aa7e1fb077b165484574ed42bde4..87538ed935b3f6bbb5b39ef4327b561dc5103840 100644 (file)
@@ -2033,7 +2033,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;
                }