As well as __ipv6_dev_mc_inc(), all code in __ipv6_dev_mc_dec() are
protected by inet6_dev->mc_lock, and RTNL is not needed.
Let's use in6_dev_get() in ipv6_dev_mc_dec() and remove ASSERT_RTNL()
in __ipv6_dev_mc_dec().
Now, we can remove the RTNL comment above addrconf_leave_solict() too.
Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20250702230210.3115355-6-kuni1840@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
 
        ipv6_dev_mc_inc(dev, &maddr);
 }
 
-/* caller must hold RTNL */
 void addrconf_leave_solict(struct inet6_dev *idev, const struct in6_addr *addr)
 {
        struct in6_addr maddr;
 
-       if (idev->dev->flags&(IFF_LOOPBACK|IFF_NOARP))
+       if (READ_ONCE(idev->dev->flags) & (IFF_LOOPBACK | IFF_NOARP))
                return;
 
        addrconf_addr_solict_mult(addr, &maddr);
 
 {
        struct ifmcaddr6 *ma, __rcu **map;
 
-       ASSERT_RTNL();
-
        mutex_lock(&idev->mc_lock);
+
        for (map = &idev->mc_list;
             (ma = mc_dereference(*map, idev));
             map = &ma->next) {
        struct inet6_dev *idev;
        int err;
 
-       ASSERT_RTNL();
-
-       idev = __in6_dev_get(dev);
+       idev = in6_dev_get(dev);
        if (!idev)
-               err = -ENODEV;
-       else
-               err = __ipv6_dev_mc_dec(idev, addr);
+               return -ENODEV;
+
+       err = __ipv6_dev_mc_dec(idev, addr);
+       in6_dev_put(idev);
 
        return err;
 }