From: David Ahern Subject: Re: [PATCH net] net: diag: Don't double-free TCP_NEW_SYN_RECV sockets in tcp_abort Date: Sat, 7 Jul 2018 16:07:16 -0600 Message-ID: References: <20180707073140.202004-1-lorenzo@google.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Cc: astrachan@google.com, subashab@codeaurora.org, eric.dumazet@gmail.com, davem@davemloft.net To: Lorenzo Colitti , netdev@vger.kernel.org Return-path: Received: from mail-pf0-f195.google.com ([209.85.192.195]:41693 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754302AbeGGWHT (ORCPT ); Sat, 7 Jul 2018 18:07:19 -0400 Received: by mail-pf0-f195.google.com with SMTP id c21-v6so6410944pfn.8 for ; Sat, 07 Jul 2018 15:07:19 -0700 (PDT) In-Reply-To: <20180707073140.202004-1-lorenzo@google.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 7/7/18 1:31 AM, Lorenzo Colitti wrote: > When tcp_diag_destroy closes a TCP_NEW_SYN_RECV socket, it first > frees it by calling inet_csk_reqsk_queue_drop_and_and_put in > tcp_abort, and then frees it again by calling sock_gen_put. > > Since tcp_abort only has one caller, and all the other codepaths > in tcp_abort don't free the socket, just remove the free in that > function. > > Cc: David Ahern > Tested: passes Android sock_diag_test.py, which exercises this codepath > Fixes: d7226c7a4dd1 ("net: diag: Fix refcnt leak in error path destroying socket") > Signed-off-by: Lorenzo Colitti > --- > net/ipv4/tcp.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > Thanks for the bugfix. Reviewed-by: David Ahern Tested-by: David Ahern