]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
ipv6: mcast: Remove mca_get().
authorKuniyuki Iwashima <kuniyu@google.com>
Wed, 2 Jul 2025 23:01:21 +0000 (16:01 -0700)
committerJakub Kicinski <kuba@kernel.org>
Wed, 9 Jul 2025 01:32:38 +0000 (18:32 -0700)
Since commit 63ed8de4be81 ("mld: add mc_lock for protecting per-interface
mld data"), the newly allocated struct ifmcaddr6 cannot be removed until
inet6_dev->mc_lock is released, so mca_get() and mc_put() are unnecessary.

Let's remove the extra refcounting.

Note that mca_get() was only used in __ipv6_dev_mc_inc().

Signed-off-by: Kuniyuki Iwashima <kuniyu@google.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Link: https://patch.msgid.link/20250702230210.3115355-5-kuni1840@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
net/ipv6/mcast.c

index 15a37352124d1b2cef1c0eb4d6056b92546669f9..aa1280df4c1f46883d893b9e78365bcc31a659c7 100644 (file)
@@ -867,11 +867,6 @@ static void mld_clear_report(struct inet6_dev *idev)
        spin_unlock_bh(&idev->mc_report_lock);
 }
 
-static void mca_get(struct ifmcaddr6 *mc)
-{
-       refcount_inc(&mc->mca_refcnt);
-}
-
 static void ma_put(struct ifmcaddr6 *mc)
 {
        if (refcount_dec_and_test(&mc->mca_refcnt)) {
@@ -988,13 +983,11 @@ static int __ipv6_dev_mc_inc(struct net_device *dev,
        rcu_assign_pointer(mc->next, idev->mc_list);
        rcu_assign_pointer(idev->mc_list, mc);
 
-       mca_get(mc);
-
        mld_del_delrec(idev, mc);
        igmp6_group_added(mc);
        inet6_ifmcaddr_notify(dev, mc, RTM_NEWMULTICAST);
        mutex_unlock(&idev->mc_lock);
-       ma_put(mc);
+
        return 0;
 }