From: Michal Ruzicka Date: Tue, 15 Aug 2006 07:20:17 +0000 (-0700) Subject: [IPV4]: Possible leak of multicast source filter sctructure X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=bb699cbca0096aa3f5f750264ec0af080732375a;p=linux-beck.git [IPV4]: Possible leak of multicast source filter sctructure There is a leak of a socket's multicast source filter list structure on closing a socket with a multicast source filter set on an interface that does not exist any more. Signed-off-by: Michal Ruzicka Acked-by: David L Stevens Signed-off-by: David S. Miller --- diff --git a/net/ipv4/igmp.c b/net/ipv4/igmp.c index 9f4b752f5a33..e981369ebe13 100644 --- a/net/ipv4/igmp.c +++ b/net/ipv4/igmp.c @@ -2199,13 +2199,13 @@ void ip_mc_drop_socket(struct sock *sk) struct in_device *in_dev; inet->mc_list = iml->next; - if ((in_dev = inetdev_by_index(iml->multi.imr_ifindex)) != NULL) { - (void) ip_mc_leave_src(sk, iml, in_dev); + in_dev = inetdev_by_index(iml->multi.imr_ifindex); + (void) ip_mc_leave_src(sk, iml, in_dev); + if (in_dev != NULL) { ip_mc_dec_group(in_dev, iml->multi.imr_multiaddr.s_addr); in_dev_put(in_dev); } sock_kfree_s(sk, iml, sizeof(*iml)); - } rtnl_unlock(); }