From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Google-Smtp-Source: AH8x224KCwnjLqH3rfqNB81vARFhPdU4/lcLY4/QM4wsfwK0cGHvyTOfEjBxP0HEzbfhvWGYIP/H ARC-Seal: i=1; a=rsa-sha256; t=1517256901; cv=none; d=google.com; s=arc-20160816; b=pZTI6hzJ2+FrxfyNurCQCULegiGpa07zUlME6fWEXIN1Wv4BQhGNcAbieeXTEJhKvR D1yaP2J+IzYsqPa9kEY/uVsP/XjZlbatgwFpxK7zclgp4AGSTGDewUAiw0BI6OQ0UwFN IuCbJO75F1UfCJNFWnlq9X2Y13iH5IKrvlZQal2QoeUVeB1dabypA7IzT7WdwjDnSYLQ VqdgZEjrAKCAjSJ80B8zCGK/EofifhB+AEv/Q4Ug8qoNJAfBjbXcmTrlDyxlfcIqVGSZ q2Pc5lkH4P7i/JwfwIXPvIqDLeU8KXgb/FjoayqVGhvsPZ1CWVqENgOxT0yw3t9s2eQX MWuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=9khqI4tXmsLKcF/Hrrun9xMqD9lTwVDohRiKEhMwFHg=; b=GbaS2p7kgxAu8yeDiwHaU5RPlYHZIuMr2JTEJddvIcSGimDwtUwkT28Qz0jOifj0Nf 4qZyQMFoT1urkYJP3LN/GmAyRvv5nee1lDgze488kuCnlFtKhMRtLP16uN67+7/6W988 RpEy+SRyD5R946mv47py5Qr/pfvdc++UjoQRX+s9f4o7Vd53ajdVDpAMcKBz6voaH2vJ ggqf5X5UhaK2Gl+3Gdq1XXp3WmL+Kbz4UPRTq01ZY8Ly642V3eRulwgAEZ1f8eZ+1e2x 1d8Foj6F+gsg1534NlWeG9ylaLufua2DHVOZDnGZe2KALgWoT8Vk7oVjjgCMlbWntBEf MpEg== ARC-Authentication-Results: i=1; mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Authentication-Results: mx.google.com; spf=softfail (google.com: domain of transitioning gregkh@linuxfoundation.org does not designate 90.92.71.90 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Dumazet , Florian Westphal , Pablo Neira Ayuso , Michal Kubecek Subject: [PATCH 4.4 35/74] netfilter: restart search if moved to other chain Date: Mon, 29 Jan 2018 13:56:40 +0100 Message-Id: <20180129123849.164057407@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180129123847.507563674@linuxfoundation.org> References: <20180129123847.507563674@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-LABELS: =?utf-8?b?IlxcU2VudCI=?= X-GMAIL-THRID: =?utf-8?q?1590958556636502524?= X-GMAIL-MSGID: =?utf-8?q?1590959172224834669?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: 4.4-stable review patch. If anyone has any objections, please let me know. ------------------ From: Florian Westphal commit 95a8d19f28e6b29377a880c6264391a62e07fccc upstream. In case nf_conntrack_tuple_taken did not find a conflicting entry check that all entries in this hash slot were tested and restart in case an entry was moved to another chain. Reported-by: Eric Dumazet Fixes: ea781f197d6a ("netfilter: nf_conntrack: use SLAB_DESTROY_BY_RCU and get rid of call_rcu()") Signed-off-by: Florian Westphal Acked-by: Eric Dumazet Signed-off-by: Pablo Neira Ayuso Acked-by: Michal Kubecek Signed-off-by: Greg Kroah-Hartman --- net/netfilter/nf_conntrack_core.c | 7 +++++++ 1 file changed, 7 insertions(+) --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c @@ -719,6 +719,7 @@ nf_conntrack_tuple_taken(const struct nf * least once for the stats anyway. */ rcu_read_lock_bh(); + begin: hlist_nulls_for_each_entry_rcu(h, n, &net->ct.hash[hash], hnnode) { ct = nf_ct_tuplehash_to_ctrack(h); if (ct != ignored_conntrack && @@ -730,6 +731,12 @@ nf_conntrack_tuple_taken(const struct nf } NF_CT_STAT_INC(net, searched); } + + if (get_nulls_value(n) != hash) { + NF_CT_STAT_INC(net, search_restart); + goto begin; + } + rcu_read_unlock_bh(); return 0;