From mboxrd@z Thu Jan 1 00:00:00 1970 From: Eric Dumazet Subject: Re: [PATCH net] net: diag: Don't double-free TCP_NEW_SYN_RECV sockets in tcp_abort Date: Sat, 7 Jul 2018 06:28:38 -0700 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, David Ahern To: Lorenzo Colitti , netdev@vger.kernel.org Return-path: Received: from mail-pf0-f195.google.com ([209.85.192.195]:44292 "EHLO mail-pf0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752171AbeGGN2l (ORCPT ); Sat, 7 Jul 2018 09:28:41 -0400 Received: by mail-pf0-f195.google.com with SMTP id j3-v6so10543320pfh.11 for ; Sat, 07 Jul 2018 06:28:41 -0700 (PDT) In-Reply-To: <20180707073140.202004-1-lorenzo@google.com> Content-Language: en-US Sender: netdev-owner@vger.kernel.org List-ID: On 07/07/2018 12: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 > --- Signed-off-by: Eric Dumazet Thanks !