From: Nandita Dukkipati Date: Fri, 3 Dec 2010 13:33:44 +0000 (+0000) Subject: tcp: Bug fix in initialization of receive window. X-Git-Tag: v2.6.34.9~70 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9436887e4dd873e46337048a48d17aa413cfc83a;p=thirdparty%2Fkernel%2Fstable.git tcp: Bug fix in initialization of receive window. commit b1afde60f2b9ee8444fba4e012dc99a3b28d224d upstream The bug has to do with boundary checks on the initial receive window. If the initial receive window falls between init_cwnd and the receive window specified by the user, the initial window is incorrectly brought down to init_cwnd. The correct behavior is to allow it to remain unchanged. Signed-off-by: Nandita Dukkipati Signed-off-by: David S. Miller Signed-off-by: Paul Gortmaker --- diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c index a5cf575f1363b..e1819aa972d4b 100644 --- a/net/ipv4/tcp_output.c +++ b/net/ipv4/tcp_output.c @@ -237,11 +237,10 @@ void tcp_select_initial_window(int __space, __u32 mss, /* when initializing use the value from init_rcv_wnd * rather than the default from above */ - if (init_rcv_wnd && - (*rcv_wnd > init_rcv_wnd * mss)) - *rcv_wnd = init_rcv_wnd * mss; - else if (*rcv_wnd > init_cwnd * mss) - *rcv_wnd = init_cwnd * mss; + if (init_rcv_wnd) + *rcv_wnd = min(*rcv_wnd, init_rcv_wnd * mss); + else + *rcv_wnd = min(*rcv_wnd, init_cwnd * mss); } /* Set the clamp no higher than max representable value */