Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758127AbZJTBIT (ORCPT ); Mon, 19 Oct 2009 21:08:19 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756251AbZJTBIS (ORCPT ); Mon, 19 Oct 2009 21:08:18 -0400 Received: from smtp.zeugmasystems.com ([70.79.96.174]:2081 "EHLO zeugmasystems.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1756130AbZJTBIR (ORCPT ); Mon, 19 Oct 2009 21:08:17 -0400 Date: Mon, 19 Oct 2009 18:08:21 -0700 (PDT) From: Anirban Sinha X-X-Sender: asinha@sleet.zeugmasystems.local To: Oleg Nesterov cc: Anirban Sinha , linux-kernel@vger.kernel.org, David Miller , netdev@vger.kernel.org Subject: [PATCH] Re: Kernel oops when clearing bgp neighbor info with TCP MD5SUM enabled In-Reply-To: Message-ID: References: <20091008.155429.02850661.davem@davemloft.net> <20091008.175703.83006470.davem@davemloft.net> <4ADA7EDC.5010402@anirban.org> <4ADB7856.7000803@anirban.org> <20091019121327.GA11423@redhat.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-OriginalArrivalTime: 20 Oct 2009 01:08:21.0955 (UTC) FILETIME=[D13AE930:01CA5121] Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1890 Lines: 54 > I'd suppose that this unbalance comes from inet_twdr_hangman() pathes. > > Could you verify this? Yes, I have now verified this. There is indeed an issue with one of the functions called by inet_twdr_hangman(). The call sequence is: inet_twdr_hangman() -> inet_twdr_do_twkill_work() -> inet_twsk_put() -> twsk_destructor(). In this case, the destructor callback is tcp_twsk_destructor() (installed from line 1208 in net/ipv4/tcp_ipv4.c and line 906 in net/ipv6/tcp_ipv6.c) . Without the TCP_MD5SUM compiled in, the function is a no-op. However, with the MD5SUM compiled in, it calls tcp_put_md5_sig_pool() (when keylen is non zero) which does an unbalanced put_cpu(). I did a grep across the entire tree. tcp_put_md5_sig_pool() is a matching function for tcp_get_md5_sig_pool() and in all other TCP IPV4 cases, it is called from net/ipv4/tcp_ipv4.c from functions tcp_v4_md5_hash_hdr() and tcp_v4_hash_skb() along with the matching get() function. So I would think that in tcp_twsk_destructor(), the call should be replaced by tcp_free_md5_sig_pool() instead. Signed-of-by: Anirban Sinha --- net/ipv4/tcp_minisocks.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/net/ipv4/tcp_minisocks.c b/net/ipv4/tcp_minisocks.c index e48c37d..dccc01e 100644 --- a/net/ipv4/tcp_minisocks.c +++ b/net/ipv4/tcp_minisocks.c @@ -363,7 +363,7 @@ void tcp_twsk_destructor(struct sock *sk) #ifdef CONFIG_TCP_MD5SIG struct tcp_timewait_sock *twsk = tcp_twsk(sk); if (twsk->tw_md5_keylen) - tcp_put_md5sig_pool(); + tcp_free_md5sig_pool(); #endif } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/