inet: fix ip_mc_drop_socket()
authorEric Dumazet <eric.dumazet@gmail.com>
Mon, 8 Nov 2010 11:15:54 +0000 (11:15 +0000)
committerDavid S. Miller <davem@davemloft.net>
Tue, 9 Nov 2010 16:26:42 +0000 (08:26 -0800)
commit 8723e1b4ad9be4444 (inet: RCU changes in inetdev_by_index())
forgot one call site in ip_mc_drop_socket()

We should not decrease idev refcount after inetdev_by_index() call,
since refcount is not increased anymore.

Reported-by: Markus Trippelsdorf <markus@trippelsdorf.de>
Reported-by: Miles Lane <miles.lane@gmail.com>
Signed-off-by: Eric Dumazet <eric.dumazet@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/igmp.c

index c8877c6c72164ccaee2af4def0025f8300bc7e80..3c53c2d89e3b47b3e42629bfe37086aeeeda7aa8 100644 (file)
@@ -2306,10 +2306,8 @@ void ip_mc_drop_socket(struct sock *sk)
 
                in_dev = inetdev_by_index(net, iml->multi.imr_ifindex);
                (void) ip_mc_leave_src(sk, iml, in_dev);
-               if (in_dev != NULL) {
+               if (in_dev != NULL)
                        ip_mc_dec_group(in_dev, iml->multi.imr_multiaddr.s_addr);
-                       in_dev_put(in_dev);
-               }
                /* decrease mem now to avoid the memleak warning */
                atomic_sub(sizeof(*iml), &sk->sk_omem_alloc);
                call_rcu(&iml->rcu, ip_mc_socklist_reclaim);