mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
tcp: fix 0 divide in __tcp_select_window()
[ Upstream commit 06425c308b ]
syszkaller fuzzer was able to trigger a divide by zero, when
TCP window scaling is not enabled.
SO_RCVBUF can be used not only to increase sk_rcvbuf, also
to decrease it below current receive buffers utilization.
If mss is negative or 0, just return a zero TCP window.
Signed-off-by: Eric Dumazet <edumazet@google.com>
Reported-by: Dmitry Vyukov <dvyukov@google.com>
Acked-by: Neal Cardwell <ncardwell@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e6fbace87c
commit
ca876dff1e
@@ -2436,9 +2436,11 @@ u32 __tcp_select_window(struct sock *sk)
|
||||
int full_space = min_t(int, tp->window_clamp, allowed_space);
|
||||
int window;
|
||||
|
||||
if (mss > full_space)
|
||||
if (unlikely(mss > full_space)) {
|
||||
mss = full_space;
|
||||
|
||||
if (mss <= 0)
|
||||
return 0;
|
||||
}
|
||||
if (free_space < (full_space >> 1)) {
|
||||
icsk->icsk_ack.quick = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user