diff options
-rw-r--r-- | net/netfilter/ipvs/ip_vs_ctl.c | 14 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_lblc.c | 20 | ||||
-rw-r--r-- | net/netfilter/ipvs/ip_vs_lblcr.c | 20 |
3 files changed, 29 insertions, 25 deletions
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index d7c2fa80cee3..c73b0c831a2d 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
@@ -3552,10 +3552,15 @@ int __net_init __ip_vs_control_init(struct net *net) | |||
3552 | tbl[idx++].data = &ipvs->sysctl_nat_icmp_send; | 3552 | tbl[idx++].data = &ipvs->sysctl_nat_icmp_send; |
3553 | 3553 | ||
3554 | 3554 | ||
3555 | #ifdef CONFIG_SYSCTL | ||
3555 | ipvs->sysctl_hdr = register_net_sysctl_table(net, net_vs_ctl_path, | 3556 | ipvs->sysctl_hdr = register_net_sysctl_table(net, net_vs_ctl_path, |
3556 | tbl); | 3557 | tbl); |
3557 | if (ipvs->sysctl_hdr == NULL) | 3558 | if (ipvs->sysctl_hdr == NULL) { |
3558 | goto err_reg; | 3559 | if (!net_eq(net, &init_net)) |
3560 | kfree(tbl); | ||
3561 | goto err_dup; | ||
3562 | } | ||
3563 | #endif | ||
3559 | ip_vs_new_estimator(net, ipvs->tot_stats); | 3564 | ip_vs_new_estimator(net, ipvs->tot_stats); |
3560 | ipvs->sysctl_tbl = tbl; | 3565 | ipvs->sysctl_tbl = tbl; |
3561 | /* Schedule defense work */ | 3566 | /* Schedule defense work */ |
@@ -3563,9 +3568,6 @@ int __net_init __ip_vs_control_init(struct net *net) | |||
3563 | schedule_delayed_work(&ipvs->defense_work, DEFENSE_TIMER_PERIOD); | 3568 | schedule_delayed_work(&ipvs->defense_work, DEFENSE_TIMER_PERIOD); |
3564 | return 0; | 3569 | return 0; |
3565 | 3570 | ||
3566 | err_reg: | ||
3567 | if (!net_eq(net, &init_net)) | ||
3568 | kfree(tbl); | ||
3569 | err_dup: | 3571 | err_dup: |
3570 | free_percpu(ipvs->cpustats); | 3572 | free_percpu(ipvs->cpustats); |
3571 | err_alloc: | 3573 | err_alloc: |
@@ -3581,7 +3583,9 @@ static void __net_exit __ip_vs_control_cleanup(struct net *net) | |||
3581 | ip_vs_kill_estimator(net, ipvs->tot_stats); | 3583 | ip_vs_kill_estimator(net, ipvs->tot_stats); |
3582 | cancel_delayed_work_sync(&ipvs->defense_work); | 3584 | cancel_delayed_work_sync(&ipvs->defense_work); |
3583 | cancel_work_sync(&ipvs->defense_work.work); | 3585 | cancel_work_sync(&ipvs->defense_work.work); |
3586 | #ifdef CONFIG_SYSCTL | ||
3584 | unregister_net_sysctl_table(ipvs->sysctl_hdr); | 3587 | unregister_net_sysctl_table(ipvs->sysctl_hdr); |
3588 | #endif | ||
3585 | proc_net_remove(net, "ip_vs_stats_percpu"); | 3589 | proc_net_remove(net, "ip_vs_stats_percpu"); |
3586 | proc_net_remove(net, "ip_vs_stats"); | 3590 | proc_net_remove(net, "ip_vs_stats"); |
3587 | proc_net_remove(net, "ip_vs"); | 3591 | proc_net_remove(net, "ip_vs"); |
diff --git a/net/netfilter/ipvs/ip_vs_lblc.c b/net/netfilter/ipvs/ip_vs_lblc.c index d5bec3371871..00b5ffab3768 100644 --- a/net/netfilter/ipvs/ip_vs_lblc.c +++ b/net/netfilter/ipvs/ip_vs_lblc.c | |||
@@ -554,33 +554,33 @@ static int __net_init __ip_vs_lblc_init(struct net *net) | |||
554 | sizeof(vs_vars_table), | 554 | sizeof(vs_vars_table), |
555 | GFP_KERNEL); | 555 | GFP_KERNEL); |
556 | if (ipvs->lblc_ctl_table == NULL) | 556 | if (ipvs->lblc_ctl_table == NULL) |
557 | goto err_dup; | 557 | return -ENOMEM; |
558 | } else | 558 | } else |
559 | ipvs->lblc_ctl_table = vs_vars_table; | 559 | ipvs->lblc_ctl_table = vs_vars_table; |
560 | ipvs->sysctl_lblc_expiration = 24*60*60*HZ; | 560 | ipvs->sysctl_lblc_expiration = 24*60*60*HZ; |
561 | ipvs->lblc_ctl_table[0].data = &ipvs->sysctl_lblc_expiration; | 561 | ipvs->lblc_ctl_table[0].data = &ipvs->sysctl_lblc_expiration; |
562 | 562 | ||
563 | #ifdef CONFIG_SYSCTL | ||
563 | ipvs->lblc_ctl_header = | 564 | ipvs->lblc_ctl_header = |
564 | register_net_sysctl_table(net, net_vs_ctl_path, | 565 | register_net_sysctl_table(net, net_vs_ctl_path, |
565 | ipvs->lblc_ctl_table); | 566 | ipvs->lblc_ctl_table); |
566 | if (!ipvs->lblc_ctl_header) | 567 | if (!ipvs->lblc_ctl_header) { |
567 | goto err_reg; | 568 | if (!net_eq(net, &init_net)) |
569 | kfree(ipvs->lblc_ctl_table); | ||
570 | return -ENOMEM; | ||
571 | } | ||
572 | #endif | ||
568 | 573 | ||
569 | return 0; | 574 | return 0; |
570 | |||
571 | err_reg: | ||
572 | if (!net_eq(net, &init_net)) | ||
573 | kfree(ipvs->lblc_ctl_table); | ||
574 | |||
575 | err_dup: | ||
576 | return -ENOMEM; | ||
577 | } | 575 | } |
578 | 576 | ||
579 | static void __net_exit __ip_vs_lblc_exit(struct net *net) | 577 | static void __net_exit __ip_vs_lblc_exit(struct net *net) |
580 | { | 578 | { |
581 | struct netns_ipvs *ipvs = net_ipvs(net); | 579 | struct netns_ipvs *ipvs = net_ipvs(net); |
582 | 580 | ||
581 | #ifdef CONFIG_SYSCTL | ||
583 | unregister_net_sysctl_table(ipvs->lblc_ctl_header); | 582 | unregister_net_sysctl_table(ipvs->lblc_ctl_header); |
583 | #endif | ||
584 | 584 | ||
585 | if (!net_eq(net, &init_net)) | 585 | if (!net_eq(net, &init_net)) |
586 | kfree(ipvs->lblc_ctl_table); | 586 | kfree(ipvs->lblc_ctl_table); |
diff --git a/net/netfilter/ipvs/ip_vs_lblcr.c b/net/netfilter/ipvs/ip_vs_lblcr.c index 61ae8cfcf0b4..bfa25f1ea9e4 100644 --- a/net/netfilter/ipvs/ip_vs_lblcr.c +++ b/net/netfilter/ipvs/ip_vs_lblcr.c | |||
@@ -754,33 +754,33 @@ static int __net_init __ip_vs_lblcr_init(struct net *net) | |||
754 | sizeof(vs_vars_table), | 754 | sizeof(vs_vars_table), |
755 | GFP_KERNEL); | 755 | GFP_KERNEL); |
756 | if (ipvs->lblcr_ctl_table == NULL) | 756 | if (ipvs->lblcr_ctl_table == NULL) |
757 | goto err_dup; | 757 | return -ENOMEM; |
758 | } else | 758 | } else |
759 | ipvs->lblcr_ctl_table = vs_vars_table; | 759 | ipvs->lblcr_ctl_table = vs_vars_table; |
760 | ipvs->sysctl_lblcr_expiration = 24*60*60*HZ; | 760 | ipvs->sysctl_lblcr_expiration = 24*60*60*HZ; |
761 | ipvs->lblcr_ctl_table[0].data = &ipvs->sysctl_lblcr_expiration; | 761 | ipvs->lblcr_ctl_table[0].data = &ipvs->sysctl_lblcr_expiration; |
762 | 762 | ||
763 | #ifdef CONFIG_SYSCTL | ||
763 | ipvs->lblcr_ctl_header = | 764 | ipvs->lblcr_ctl_header = |
764 | register_net_sysctl_table(net, net_vs_ctl_path, | 765 | register_net_sysctl_table(net, net_vs_ctl_path, |
765 | ipvs->lblcr_ctl_table); | 766 | ipvs->lblcr_ctl_table); |
766 | if (!ipvs->lblcr_ctl_header) | 767 | if (!ipvs->lblcr_ctl_header) { |
767 | goto err_reg; | 768 | if (!net_eq(net, &init_net)) |
769 | kfree(ipvs->lblcr_ctl_table); | ||
770 | return -ENOMEM; | ||
771 | } | ||
772 | #endif | ||
768 | 773 | ||
769 | return 0; | 774 | return 0; |
770 | |||
771 | err_reg: | ||
772 | if (!net_eq(net, &init_net)) | ||
773 | kfree(ipvs->lblcr_ctl_table); | ||
774 | |||
775 | err_dup: | ||
776 | return -ENOMEM; | ||
777 | } | 775 | } |
778 | 776 | ||
779 | static void __net_exit __ip_vs_lblcr_exit(struct net *net) | 777 | static void __net_exit __ip_vs_lblcr_exit(struct net *net) |
780 | { | 778 | { |
781 | struct netns_ipvs *ipvs = net_ipvs(net); | 779 | struct netns_ipvs *ipvs = net_ipvs(net); |
782 | 780 | ||
781 | #ifdef CONFIG_SYSCTL | ||
783 | unregister_net_sysctl_table(ipvs->lblcr_ctl_header); | 782 | unregister_net_sysctl_table(ipvs->lblcr_ctl_header); |
783 | #endif | ||
784 | 784 | ||
785 | if (!net_eq(net, &init_net)) | 785 | if (!net_eq(net, &init_net)) |
786 | kfree(ipvs->lblcr_ctl_table); | 786 | kfree(ipvs->lblcr_ctl_table); |