diff options
Diffstat (limited to 'net/802/garp.c')
-rw-r--r-- | net/802/garp.c | 22 |
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 | ||
547 | static void garp_kfree_rcu(struct rcu_head *head) | ||
548 | { | ||
549 | kfree(container_of(head, struct garp_port, rcu)); | ||
550 | } | ||
551 | |||
547 | static void garp_release_port(struct net_device *dev) | 552 | static 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 | ||
561 | int garp_init_applicant(struct net_device *dev, struct garp_application *appl) | 565 | int garp_init_applicant(struct net_device *dev, struct garp_application *appl) |
@@ -599,6 +603,11 @@ err1: | |||
599 | } | 603 | } |
600 | EXPORT_SYMBOL_GPL(garp_init_applicant); | 604 | EXPORT_SYMBOL_GPL(garp_init_applicant); |
601 | 605 | ||
606 | static void garp_app_kfree_rcu(struct rcu_head *head) | ||
607 | { | ||
608 | kfree(container_of(head, struct garp_applicant, rcu)); | ||
609 | } | ||
610 | |||
602 | void garp_uninit_applicant(struct net_device *dev, struct garp_application *appl) | 611 | void 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 | } |
623 | EXPORT_SYMBOL_GPL(garp_uninit_applicant); | 631 | EXPORT_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 | } |
637 | EXPORT_SYMBOL_GPL(garp_unregister_application); | 645 | EXPORT_SYMBOL_GPL(garp_unregister_application); |
646 | |||
647 | static void __exit garp_cleanup_module(void) | ||
648 | { | ||
649 | rcu_barrier(); /* Wait for completion of call_rcu()'s */ | ||
650 | } | ||
651 | module_exit(garp_cleanup_module); | ||