From mboxrd@z Thu Jan 1 00:00:00 1970 From: Greg KH Subject: Re: [PATCH stable 4.4 6/9] tcp: avoid collapses in tcp_prune_queue() if possible Date: Wed, 15 Aug 2018 15:25:18 +0200 Message-ID: <20180815132518.GI31330@kroah.com> References: <1534339268-111834-1-git-send-email-maowenan@huawei.com> <1534339268-111834-7-git-send-email-maowenan@huawei.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: dwmw2@infradead.org, netdev@vger.kernel.org, eric.dumazet@gmail.com, edumazet@google.com, davem@davemloft.net, ycheng@google.com, jdw@amazon.de To: Mao Wenan Return-path: Received: from mail.linuxfoundation.org ([140.211.169.12]:45342 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728885AbeHOQRb (ORCPT ); Wed, 15 Aug 2018 12:17:31 -0400 Content-Disposition: inline In-Reply-To: <1534339268-111834-7-git-send-email-maowenan@huawei.com> Sender: netdev-owner@vger.kernel.org List-ID: On Wed, Aug 15, 2018 at 09:21:05PM +0800, Mao Wenan wrote: > From: Eric Dumazet > > [ Upstream commit f4a3313d8e2ca9fd8d8f45e40a2903ba782607e7 ] > > Right after a TCP flow is created, receiving tiny out of order > packets allways hit the condition : > > if (atomic_read(&sk->sk_rmem_alloc) >= sk->sk_rcvbuf) > tcp_clamp_window(sk); > > tcp_clamp_window() increases sk_rcvbuf to match sk_rmem_alloc > (guarded by tcp_rmem[2]) > > Calling tcp_collapse_ofo_queue() in this case is not useful, > and offers a O(N^2) surface attack to malicious peers. > > Better not attempt anything before full queue capacity is reached, > forcing attacker to spend lots of resource and allow us to more > easily detect the abuse. > > Signed-off-by: Eric Dumazet > Acked-by: Soheil Hassas Yeganeh > Acked-by: Yuchung Cheng > Signed-off-by: David S. Miller > Signed-off-by: Greg Kroah-Hartman > Signed-off-by: root root?