Commit e2401654dd0f5f3fb7a8d80dad9554d73d7ca394

Authored by Salam Noureddine
Committed by David S. Miller
1 parent 437a3ae1d0

ipv4 igmp: use in_dev_put in timer handlers instead of __in_dev_put

It is possible for the timer handlers to run after the call to
ip_mc_down so use in_dev_put instead of __in_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 in_device 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 2 additions and 2 deletions Side-by-side Diff

... ... @@ -736,7 +736,7 @@
736 736  
737 737 in_dev->mr_gq_running = 0;
738 738 igmpv3_send_report(in_dev, NULL);
739   - __in_dev_put(in_dev);
  739 + in_dev_put(in_dev);
740 740 }
741 741  
742 742 static void igmp_ifc_timer_expire(unsigned long data)
... ... @@ -749,7 +749,7 @@
749 749 igmp_ifc_start_timer(in_dev,
750 750 unsolicited_report_interval(in_dev));
751 751 }
752   - __in_dev_put(in_dev);
  752 + in_dev_put(in_dev);
753 753 }
754 754  
755 755 static void igmp_ifc_event(struct in_device *in_dev)