netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Amol Grover <frextrite@gmail.com>
To: Pablo Neira Ayuso <pablo@netfilter.org>,
	Jozsef Kadlecsik <kadlec@netfilter.org>,
	Florian Westphal <fw@strlen.de>,
	"David S . Miller" <davem@davemloft.net>,
	Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	Jakub Kicinski <kuba@kernel.org>
Cc: linux-kernel@vger.kernel.org,
	linux-kernel-mentees@lists.linuxfoundation.org,
	Joel Fernandes <joel@joelfernandes.org>,
	Madhuparna Bhowmik <madhuparnabhowmik10@gmail.com>,
	"Paul E . McKenney" <paulmck@kernel.org>,
	netfilter-devel@vger.kernel.org, coreteam@netfilter.org,
	netdev@vger.kernel.org, Amol Grover <frextrite@gmail.com>
Subject: [PATCH] netfilter: ipt_CLUSTERIP: Pass lockdep expression to RCU lists
Date: Wed, 19 Feb 2020 15:46:27 +0530	[thread overview]
Message-ID: <20200219101626.31943-1-frextrite@gmail.com> (raw)

cn->configs is traversed using list_for_each_entry_rcu
outside an RCU read-side critical section but under the protection
of cn->lock.

Hence, add corresponding lockdep expression to silence false-positive
warnings, and harden RCU lists.

Signed-off-by: Amol Grover <frextrite@gmail.com>
---
 net/ipv4/netfilter/ipt_CLUSTERIP.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/ipv4/netfilter/ipt_CLUSTERIP.c b/net/ipv4/netfilter/ipt_CLUSTERIP.c
index 6bdb1ab8af61..df856ff835b7 100644
--- a/net/ipv4/netfilter/ipt_CLUSTERIP.c
+++ b/net/ipv4/netfilter/ipt_CLUSTERIP.c
@@ -139,7 +139,8 @@ __clusterip_config_find(struct net *net, __be32 clusterip)
 	struct clusterip_config *c;
 	struct clusterip_net *cn = clusterip_pernet(net);
 
-	list_for_each_entry_rcu(c, &cn->configs, list) {
+	list_for_each_entry_rcu(c, &cn->configs, list,
+				lockdep_is_held(&cn->lock)) {
 		if (c->clusterip == clusterip)
 			return c;
 	}
@@ -194,7 +195,8 @@ clusterip_netdev_event(struct notifier_block *this, unsigned long event,
 	struct clusterip_config *c;
 
 	spin_lock_bh(&cn->lock);
-	list_for_each_entry_rcu(c, &cn->configs, list) {
+	list_for_each_entry_rcu(c, &cn->configs, list,
+				lockdep_is_held(&cn->lock)) {
 		switch (event) {
 		case NETDEV_REGISTER:
 			if (!strcmp(dev->name, c->ifname)) {
-- 
2.24.1


             reply	other threads:[~2020-02-19 10:17 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-19 10:16 Amol Grover [this message]
2020-03-02 12:37 ` [PATCH] netfilter: ipt_CLUSTERIP: Pass lockdep expression to RCU lists Pablo Neira Ayuso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200219101626.31943-1-frextrite@gmail.com \
    --to=frextrite@gmail.com \
    --cc=coreteam@netfilter.org \
    --cc=davem@davemloft.net \
    --cc=fw@strlen.de \
    --cc=joel@joelfernandes.org \
    --cc=kadlec@netfilter.org \
    --cc=kuba@kernel.org \
    --cc=kuznet@ms2.inr.ac.ru \
    --cc=linux-kernel-mentees@lists.linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=madhuparnabhowmik10@gmail.com \
    --cc=netdev@vger.kernel.org \
    --cc=netfilter-devel@vger.kernel.org \
    --cc=pablo@netfilter.org \
    --cc=paulmck@kernel.org \
    --cc=yoshfuji@linux-ipv6.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).