Received: by 10.223.176.5 with SMTP id f5csp492783wra; Wed, 7 Feb 2018 02:45:04 -0800 (PST) X-Google-Smtp-Source: AH8x2268uGvgwot3E/pCu10QaFX7tiuPLqEvw/mH/1//ggkhtTJWTQ4Sh/II5ugJ5KZgnWUQOaqc X-Received: by 2002:a17:902:47c2:: with SMTP id d2-v6mr5656065plh.222.1518000303922; Wed, 07 Feb 2018 02:45:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518000303; cv=none; d=google.com; s=arc-20160816; b=eMHVGDfMYpc2QTw3GeRo97Uf5wcxrTZAUwXegM45ETTFuBRaXAkeDtUEh4v1+Zuo+X vnqBI5ho8H6ziZYe08QRyB72Tp8TpK/5iEvpITpkIFZwOA/WG3ohmgZTw4mqW8uXhkbp 9w3t2fZ5I6mR2gU0I170FqqfV8CWUSZ8d7hXytDGRypmjhGl1eEA/crHz3nJ4XK/Qg3Y kUlRMGjoWg1jvP2J3EI3SgvyfSe+R8klLL1HgosuXNFw1M8zWFtC9FLCbnweEjWmclN5 2HSKaJhDcF6aL9/wtNHb5bEkBt3gpK53cQQpxp0kifPLCyGFtCLknjOzLwA2EQRXPOb7 FDFA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=yG0gQcHqtSuB0k484pSZpKY4fY/39n1IRLaypqn/8QI=; b=tlqCWZbcNa+GVOWV82bML2iGEsbdNUJcYZJI1iEIwiAKNtm7CrvoeIYadj9rly1tbF Q3CCzl3E1MEuCjhBCxrYwP2en/8Gcut/YTB0sqD7wF3GWnKUrFN/jht5En6Ki0oSQ5nJ +OADUWo8nf7eIBcoV5UcD5x8khNhKkmGaLRD/zHB+tk4vcS2WUnEuKeCnyVjqEvTEP1p V9W6cOnJ1VrDHVCor72dUcWUzuFa44KkE55TOOMQoyp6aIZofvDB808n7B3x80S2v/RZ 3bm1vRn+uYa95RQQLMr3HSWLPSv86DE1Tsp5m7Dkh7QGj3njo6Kj6GJEgpqqZt8iGHd2 s7FA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y14-v6si895538pll.484.2018.02.07.02.44.49; Wed, 07 Feb 2018 02:45:03 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754087AbeBGKm3 (ORCPT + 99 others); Wed, 7 Feb 2018 05:42:29 -0500 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:32934 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753470AbeBGKm0 (ORCPT ); Wed, 7 Feb 2018 05:42:26 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 842B47C6BB; Wed, 7 Feb 2018 10:42:25 +0000 (UTC) Received: from localhost.localdomain.com (unknown [10.32.181.99]) by smtp.corp.redhat.com (Postfix) with ESMTP id 7BBEE2024CA2; Wed, 7 Feb 2018 10:42:21 +0000 (UTC) From: Paolo Abeni To: netdev@vger.kernel.org Cc: coreteam@netfilter.org, davem@davemloft.net, fw@strlen.de, kadlec@blackhole.kfki.hu, kuznet@ms2.inr.ac.ru, linux-kernel@vger.kernel.org, netfilter-devel@vger.kernel.org, pablo@netfilter.org, syzkaller-bugs@googlegroups.com, yoshfuji@linux-ipv6.org, Cong Wang Subject: Re: WARNING: proc registration bug in clusterip_tg_check Date: Wed, 7 Feb 2018 11:41:48 +0100 Message-Id: <945c8517a87c671825b61223088064ea2ad0a8cb.1517999262.git.pabeni@redhat.com> In-Reply-To: <089e082d13a0cf25ed05648bf8b3@google.com> References: <089e082d13a0cf25ed05648bf8b3@google.com> X-Scanned-By: MIMEDefang 2.78 on 10.11.54.4 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 07 Feb 2018 10:42:25 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 07 Feb 2018 10:42:25 +0000 (UTC) for IP:'10.11.54.4' DOMAIN:'int-mx04.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'pabeni@redhat.com' RCPT:'' Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org #syz test: git://git.kernel.org/pub/scm/linux/kernel/git/davem/net.git master I can't reproduce the issue locally, so asking the syzbot to test the tentive fix for me (and hoping I did not mess with the tag/format) --- net/ipv4/netfilter/ipt_CLUSTERIP.c | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c index 3a84a60f6b39..db103cd971a9 100644 --- a/net/ipv4/netfilter/ipt_CLUSTERIP.c +++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c @@ -230,17 +230,6 @@ clusterip_config_init(struct net *net, const struct ipt_clusterip_tgt_info *i, refcount_set(&c->refcount, 1); refcount_set(&c->entries, 1); - spin_lock_bh(&cn->lock); - if (__clusterip_config_find(net, ip)) { - spin_unlock_bh(&cn->lock); - kfree(c); - - return ERR_PTR(-EBUSY); - } - - list_add_rcu(&c->list, &cn->configs); - spin_unlock_bh(&cn->lock); - #ifdef CONFIG_PROC_FS { char buffer[16]; @@ -257,20 +246,31 @@ clusterip_config_init(struct net *net, const struct ipt_clusterip_tgt_info *i, } #endif + spin_lock_bh(&cn->lock); + if (__clusterip_config_find(net, ip)) { + spin_unlock_bh(&cn->lock); + err = -EBUSY; + goto err_remove_pte: + } + + list_add_rcu(&c->list, &cn->configs); + spin_unlock_bh(&cn->lock); + c->notifier.notifier_call = clusterip_netdev_event; err = register_netdevice_notifier(&c->notifier); if (!err) return c; + spin_lock_bh(&cn->lock); + list_del_rcu(&c->list); + spin_unlock_bh(&cn->lock); + +err_remove_pte: #ifdef CONFIG_PROC_FS proc_remove(c->pde); err: #endif - spin_lock_bh(&cn->lock); - list_del_rcu(&c->list); - spin_unlock_bh(&cn->lock); kfree(c); - return ERR_PTR(err); } -- 2.14.3