* [PATCH net] tcp: fix 0 divide in __tcp_select_window()
@ 2017-02-01 16:33 Eric Dumazet
2017-02-01 16:41 ` Neal Cardwell
2017-02-01 17:56 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Eric Dumazet @ 2017-02-01 16:33 UTC (permalink / raw)
To: David Miller; +Cc: netdev, Dmitry Vyukov
From: Eric Dumazet <edumazet@google.com>
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>
---
No Fixes: tag, this is a day-0 bug.
net/ipv4/tcp_output.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/net/ipv4/tcp_output.c b/net/ipv4/tcp_output.c
index 1d5331a1b1dc2677316148ba9852c191e7ed0fd4..8ce50dc3ab8cac821b8a2c3e0d31f0aa42f5c9d5 100644
--- a/net/ipv4/tcp_output.c
+++ b/net/ipv4/tcp_output.c
@@ -2518,9 +2518,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;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] tcp: fix 0 divide in __tcp_select_window()
2017-02-01 16:33 [PATCH net] tcp: fix 0 divide in __tcp_select_window() Eric Dumazet
@ 2017-02-01 16:41 ` Neal Cardwell
2017-02-01 17:56 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Neal Cardwell @ 2017-02-01 16:41 UTC (permalink / raw)
To: Eric Dumazet; +Cc: David Miller, netdev, Dmitry Vyukov
On Wed, Feb 1, 2017 at 11:33 AM, Eric Dumazet <eric.dumazet@gmail.com> wrote:
>
> From: Eric Dumazet <edumazet@google.com>
>
> 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>
Thanks, Eric!
neal
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] tcp: fix 0 divide in __tcp_select_window()
2017-02-01 16:33 [PATCH net] tcp: fix 0 divide in __tcp_select_window() Eric Dumazet
2017-02-01 16:41 ` Neal Cardwell
@ 2017-02-01 17:56 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-02-01 17:56 UTC (permalink / raw)
To: eric.dumazet; +Cc: netdev, dvyukov
From: Eric Dumazet <eric.dumazet@gmail.com>
Date: Wed, 01 Feb 2017 08:33:53 -0800
> From: Eric Dumazet <edumazet@google.com>
>
> 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>
> ---
> No Fixes: tag, this is a day-0 bug.
Applied and queued up for -stable, thanks Eric.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-02-01 17:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-02-01 16:33 [PATCH net] tcp: fix 0 divide in __tcp_select_window() Eric Dumazet
2017-02-01 16:41 ` Neal Cardwell
2017-02-01 17:56 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.