ipv6: addrconf: Avoid addrconf_disable_change() using RCU read-side lock
authorKefeng Wang <wangkefeng.wang@huawei.com>
Thu, 19 Jan 2017 08:26:21 +0000 (16:26 +0800)
committerDanny Wood <danwood76@gmail.com>
Tue, 29 Jan 2019 13:17:21 +0000 (13:17 +0000)
commit 03e4deff4987f79c34112c5ba4eb195d4f9382b0 upstream.

Just like commit 4acd4945cd1e ("ipv6: addrconf: Avoid calling
netdevice notifiers with RCU read-side lock"), it is unnecessary
to make addrconf_disable_change() use RCU iteration over the
netdev list, since it already holds the RTNL lock, or we may meet
Illegal context switch in RCU read-side critical section.

Signed-off-by: Kefeng Wang <wangkefeng.wang@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
net/ipv6/addrconf.c

index aeaff8a48f8a8709263a1d257bee520142da6e46..e25502cf0c9e4da4e7f97743cebe16ef850553fc 100644 (file)
@@ -4841,8 +4841,7 @@ static void addrconf_disable_change(struct net *net, __s32 newf)
        struct net_device *dev;
        struct inet6_dev *idev;
 
-       rcu_read_lock();
-       for_each_netdev_rcu(net, dev) {
+       for_each_netdev(net, dev) {
                idev = __in6_dev_get(dev);
                if (idev) {
                        int changed = (!idev->cnf.disable_ipv6) ^ (!newf);
@@ -4851,7 +4850,6 @@ static void addrconf_disable_change(struct net *net, __s32 newf)
                                dev_disable_change(idev);
                }
        }
-       rcu_read_unlock();
 }
 
 static int addrconf_disable_ipv6(struct ctl_table *table, int *p, int newf)