[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200219101626.31943-1-frextrite@gmail.com>
Date: Wed, 19 Feb 2020 15:46:27 +0530
From: Amol Grover <frextrite@...il.com>
To: Pablo Neira Ayuso <pablo@...filter.org>,
Jozsef Kadlecsik <kadlec@...filter.org>,
Florian Westphal <fw@...len.de>,
"David S . Miller" <davem@...emloft.net>,
Alexey Kuznetsov <kuznet@....inr.ac.ru>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
Jakub Kicinski <kuba@...nel.org>
Cc: linux-kernel@...r.kernel.org,
linux-kernel-mentees@...ts.linuxfoundation.org,
Joel Fernandes <joel@...lfernandes.org>,
Madhuparna Bhowmik <madhuparnabhowmik10@...il.com>,
"Paul E . McKenney" <paulmck@...nel.org>,
netfilter-devel@...r.kernel.org, coreteam@...filter.org,
netdev@...r.kernel.org, Amol Grover <frextrite@...il.com>
Subject: [PATCH] netfilter: ipt_CLUSTERIP: Pass lockdep expression to RCU lists
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@...il.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
Powered by blists - more mailing lists