aboutsummaryrefslogtreecommitdiffstats
path: root/net/802/garp.c
diff options
context:
space:
mode:
Diffstat (limited to 'net/802/garp.c')
-rw-r--r--net/802/garp.c22
1 files changed, 18 insertions, 4 deletions
diff --git a/net/802/garp.c b/net/802/garp.c
index c1df2dad8c6b..f8300a8b5fbc 100644
--- a/net/802/garp.c
+++ b/net/802/garp.c
@@ -544,6 +544,11 @@ static int garp_init_port(struct net_device *dev)
544 return 0; 544 return 0;
545} 545}
546 546
547static void garp_kfree_rcu(struct rcu_head *head)
548{
549 kfree(container_of(head, struct garp_port, rcu));
550}
551
547static void garp_release_port(struct net_device *dev) 552static void garp_release_port(struct net_device *dev)
548{ 553{
549 struct garp_port *port = rtnl_dereference(dev->garp_port); 554 struct garp_port *port = rtnl_dereference(dev->garp_port);
@@ -554,8 +559,7 @@ static void garp_release_port(struct net_device *dev)
554 return; 559 return;
555 } 560 }
556 rcu_assign_pointer(dev->garp_port, NULL); 561 rcu_assign_pointer(dev->garp_port, NULL);
557 synchronize_rcu(); 562 call_rcu(&port->rcu, garp_kfree_rcu);
558 kfree(port);
559} 563}
560 564
561int garp_init_applicant(struct net_device *dev, struct garp_application *appl) 565int garp_init_applicant(struct net_device *dev, struct garp_application *appl)
@@ -599,6 +603,11 @@ err1:
599} 603}
600EXPORT_SYMBOL_GPL(garp_init_applicant); 604EXPORT_SYMBOL_GPL(garp_init_applicant);
601 605
606static void garp_app_kfree_rcu(struct rcu_head *head)
607{
608 kfree(container_of(head, struct garp_applicant, rcu));
609}
610
602void garp_uninit_applicant(struct net_device *dev, struct garp_application *appl) 611void garp_uninit_applicant(struct net_device *dev, struct garp_application *appl)
603{ 612{
604 struct garp_port *port = rtnl_dereference(dev->garp_port); 613 struct garp_port *port = rtnl_dereference(dev->garp_port);
@@ -607,7 +616,6 @@ void garp_uninit_applicant(struct net_device *dev, struct garp_application *appl
607 ASSERT_RTNL(); 616 ASSERT_RTNL();
608 617
609 rcu_assign_pointer(port->applicants[appl->type], NULL); 618 rcu_assign_pointer(port->applicants[appl->type], NULL);
610 synchronize_rcu();
611 619
612 /* Delete timer and generate a final TRANSMIT_PDU event to flush out 620 /* Delete timer and generate a final TRANSMIT_PDU event to flush out
613 * all pending messages before the applicant is gone. */ 621 * all pending messages before the applicant is gone. */
@@ -617,7 +625,7 @@ void garp_uninit_applicant(struct net_device *dev, struct garp_application *appl
617 garp_queue_xmit(app); 625 garp_queue_xmit(app);
618 626
619 dev_mc_del(dev, appl->proto.group_address); 627 dev_mc_del(dev, appl->proto.group_address);
620 kfree(app); 628 call_rcu(&app->rcu, garp_app_kfree_rcu);
621 garp_release_port(dev); 629 garp_release_port(dev);
622} 630}
623EXPORT_SYMBOL_GPL(garp_uninit_applicant); 631EXPORT_SYMBOL_GPL(garp_uninit_applicant);
@@ -635,3 +643,9 @@ void garp_unregister_application(struct garp_application *appl)
635 stp_proto_unregister(&appl->proto); 643 stp_proto_unregister(&appl->proto);
636} 644}
637EXPORT_SYMBOL_GPL(garp_unregister_application); 645EXPORT_SYMBOL_GPL(garp_unregister_application);
646
647static void __exit garp_cleanup_module(void)
648{
649 rcu_barrier(); /* Wait for completion of call_rcu()'s */
650}
651module_exit(garp_cleanup_module);