Commit 9260d3e1013701aa814d10c8fc6a9f92bd17d643

Authored by Salam Noureddine
Committed by David S. Miller
1 parent e2401654dd

ipv6 mcast: use in6_dev_put in timer handlers instead of __in6_dev_put

It is possible for the timer handlers to run after the call to
ipv6_mc_down so use in6_dev_put instead of __in6_dev_put in the
handler function in order to do proper cleanup when the refcnt
reaches 0. Otherwise, the refcnt can reach zero without the
inet6_dev being destroyed and we end up leaking a reference to
the net_device and see messages like the following,

unregister_netdevice: waiting for eth0 to become free. Usage count = 1

Tested on linux-3.4.43.

Signed-off-by: Salam Noureddine <noureddine@aristanetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

Showing 1 changed file with 3 additions and 3 deletions Side-by-side Diff

... ... @@ -2034,7 +2034,7 @@
2034 2034 if (idev->mc_dad_count)
2035 2035 mld_dad_start_timer(idev, idev->mc_maxdelay);
2036 2036 }
2037   - __in6_dev_put(idev);
  2037 + in6_dev_put(idev);
2038 2038 }
2039 2039  
2040 2040 static int ip6_mc_del1_src(struct ifmcaddr6 *pmc, int sfmode,
... ... @@ -2379,7 +2379,7 @@
2379 2379  
2380 2380 idev->mc_gq_running = 0;
2381 2381 mld_send_report(idev, NULL);
2382   - __in6_dev_put(idev);
  2382 + in6_dev_put(idev);
2383 2383 }
2384 2384  
2385 2385 static void mld_ifc_timer_expire(unsigned long data)
... ... @@ -2392,7 +2392,7 @@
2392 2392 if (idev->mc_ifc_count)
2393 2393 mld_ifc_start_timer(idev, idev->mc_maxdelay);
2394 2394 }
2395   - __in6_dev_put(idev);
  2395 + in6_dev_put(idev);
2396 2396 }
2397 2397  
2398 2398 static void mld_ifc_event(struct inet6_dev *idev)