From: Eric Dumazet Subject: Re: [PATCH net] net: diag: Don't double-free TCP_NEW_SYN_RECV sockets in tcp_abort Date: Mon, 9 Jul 2018 08:17:00 -0700 Message-ID: <593e8213-16ea-0a9c-2a23-63450c770455@gmail.com> References: <20180707073140.202004-1-lorenzo@google.com> <20180707.221146.161981342461262899.davem@davemloft.net> <1acf7d5a-4465-120e-70bf-4fe24b1f7e3e@cumulusnetworks.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: David Miller , netdev@vger.kernel.org, Alistair Strachan , Subash Abhinov Kasiviswanathan To: David Ahern , Lorenzo Colitti , Eric Dumazet Return-path: Received: from mail-oi0-f68.google.com ([209.85.218.68]:35158 "EHLO mail-oi0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933045AbeGIPRD (ORCPT ); Mon, 9 Jul 2018 11:17:03 -0400 Received: by mail-oi0-f68.google.com with SMTP id i12-v6so36569158oik.2 for ; Mon, 09 Jul 2018 08:17:03 -0700 (PDT) In-Reply-To: <1acf7d5a-4465-120e-70bf-4fe24b1f7e3e@cumulusnetworks.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 07/09/2018 07:59 AM, David Ahern wrote: > On 7/8/18 10:53 PM, Lorenzo Colitti wrote: >> On Sat, Jul 7, 2018 at 10:29 PM Eric Dumazet wrote: >>>>> Tested: passes Android sock_diag_test.py, which exercises this codepath >>>> >>>> If this Android test case exercises this path, why didn't it trigger >>>> the double free and thus cause this bug to be found much sooner? >>>> >>>> Just curious. >>> >>> Presumably android has not backported yet the refcount_t stuff in their kernels. >> >> That's correct. We only started seeing this on 4.14, which is not yet >> in the field. > > Prior to 4.12 syn-recv sockets did not show up in the list, so it could > not be closed through the diag API. I did not chase it to a specific > commit between 4.11 (no syn-recv in 'ss -ta') and 4.12 (syn-recv shows > up in 'ss -ta'). > I suggest you look more closely to tcp_abort(), the function you changed in commit d7226c7a4dd1 (linux-4.8) Then you will see it had support for syn-recv since linux-4.5 So I do not understand your 4.11/4.12 mentions at all. "ss -ta" always had dumped syn-recv request sockets.