aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexey Dobriyan <adobriyan@sw.ru>2008-01-31 07:05:34 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-31 22:27:41 -0500
commitdf200969b1627e8f1cda7ce8c0707863f91bb81b (patch)
tree3dbc2d882177568f8c0047b5e10597af12599f67
parent9ea0cb2601c4747dff758a9a7a5a4a433ad527f3 (diff)
[NETFILTER]: netns: put table module on netns stop
When number of entries exceeds number of initial entries, foo-tables code will pin table module. But during table unregister on netns stop, that additional pin was forgotten. Signed-off-by: Alexey Dobriyan <adobriyan@sw.ru> Signed-off-by: Patrick McHardy <kaber@trash.net> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--net/ipv4/netfilter/arp_tables.c3
-rw-r--r--net/ipv4/netfilter/ip_tables.c3
-rw-r--r--net/ipv6/netfilter/ip6_tables.c3
3 files changed, 9 insertions, 0 deletions
diff --git a/net/ipv4/netfilter/arp_tables.c b/net/ipv4/netfilter/arp_tables.c
index ec64b679641d..3608675ab08c 100644
--- a/net/ipv4/netfilter/arp_tables.c
+++ b/net/ipv4/netfilter/arp_tables.c
@@ -1773,6 +1773,7 @@ void arpt_unregister_table(struct arpt_table *table)
1773{ 1773{
1774 struct xt_table_info *private; 1774 struct xt_table_info *private;
1775 void *loc_cpu_entry; 1775 void *loc_cpu_entry;
1776 struct module *table_owner = table->me;
1776 1777
1777 private = xt_unregister_table(table); 1778 private = xt_unregister_table(table);
1778 1779
@@ -1780,6 +1781,8 @@ void arpt_unregister_table(struct arpt_table *table)
1780 loc_cpu_entry = private->entries[raw_smp_processor_id()]; 1781 loc_cpu_entry = private->entries[raw_smp_processor_id()];
1781 ARPT_ENTRY_ITERATE(loc_cpu_entry, private->size, 1782 ARPT_ENTRY_ITERATE(loc_cpu_entry, private->size,
1782 cleanup_entry, NULL); 1783 cleanup_entry, NULL);
1784 if (private->number > private->initial_entries)
1785 module_put(table_owner);
1783 xt_free_table_info(private); 1786 xt_free_table_info(private);
1784} 1787}
1785 1788
diff --git a/net/ipv4/netfilter/ip_tables.c b/net/ipv4/netfilter/ip_tables.c
index c1b80f4cb7cc..427bc9b3d342 100644
--- a/net/ipv4/netfilter/ip_tables.c
+++ b/net/ipv4/netfilter/ip_tables.c
@@ -2095,12 +2095,15 @@ void ipt_unregister_table(struct xt_table *table)
2095{ 2095{
2096 struct xt_table_info *private; 2096 struct xt_table_info *private;
2097 void *loc_cpu_entry; 2097 void *loc_cpu_entry;
2098 struct module *table_owner = table->me;
2098 2099
2099 private = xt_unregister_table(table); 2100 private = xt_unregister_table(table);
2100 2101
2101 /* Decrease module usage counts and free resources */ 2102 /* Decrease module usage counts and free resources */
2102 loc_cpu_entry = private->entries[raw_smp_processor_id()]; 2103 loc_cpu_entry = private->entries[raw_smp_processor_id()];
2103 IPT_ENTRY_ITERATE(loc_cpu_entry, private->size, cleanup_entry, NULL); 2104 IPT_ENTRY_ITERATE(loc_cpu_entry, private->size, cleanup_entry, NULL);
2105 if (private->number > private->initial_entries)
2106 module_put(table_owner);
2104 xt_free_table_info(private); 2107 xt_free_table_info(private);
2105} 2108}
2106 2109
diff --git a/net/ipv6/netfilter/ip6_tables.c b/net/ipv6/netfilter/ip6_tables.c
index 2453dfdc91aa..6fabb73ff445 100644
--- a/net/ipv6/netfilter/ip6_tables.c
+++ b/net/ipv6/netfilter/ip6_tables.c
@@ -2121,12 +2121,15 @@ void ip6t_unregister_table(struct xt_table *table)
2121{ 2121{
2122 struct xt_table_info *private; 2122 struct xt_table_info *private;
2123 void *loc_cpu_entry; 2123 void *loc_cpu_entry;
2124 struct module *table_owner = table->me;
2124 2125
2125 private = xt_unregister_table(table); 2126 private = xt_unregister_table(table);
2126 2127
2127 /* Decrease module usage counts and free resources */ 2128 /* Decrease module usage counts and free resources */
2128 loc_cpu_entry = private->entries[raw_smp_processor_id()]; 2129 loc_cpu_entry = private->entries[raw_smp_processor_id()];
2129 IP6T_ENTRY_ITERATE(loc_cpu_entry, private->size, cleanup_entry, NULL); 2130 IP6T_ENTRY_ITERATE(loc_cpu_entry, private->size, cleanup_entry, NULL);
2131 if (private->number > private->initial_entries)
2132 module_put(table_owner);
2130 xt_free_table_info(private); 2133 xt_free_table_info(private);
2131} 2134}
2132 2135