Commit df200969 authored by Alexey Dobriyan's avatar Alexey Dobriyan Committed by David S. Miller

[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: default avatarAlexey Dobriyan <adobriyan@sw.ru>
Signed-off-by: default avatarPatrick McHardy <kaber@trash.net>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 9ea0cb26
...@@ -1773,6 +1773,7 @@ void arpt_unregister_table(struct arpt_table *table) ...@@ -1773,6 +1773,7 @@ void arpt_unregister_table(struct arpt_table *table)
{ {
struct xt_table_info *private; struct xt_table_info *private;
void *loc_cpu_entry; void *loc_cpu_entry;
struct module *table_owner = table->me;
private = xt_unregister_table(table); private = xt_unregister_table(table);
...@@ -1780,6 +1781,8 @@ void arpt_unregister_table(struct arpt_table *table) ...@@ -1780,6 +1781,8 @@ void arpt_unregister_table(struct arpt_table *table)
loc_cpu_entry = private->entries[raw_smp_processor_id()]; loc_cpu_entry = private->entries[raw_smp_processor_id()];
ARPT_ENTRY_ITERATE(loc_cpu_entry, private->size, ARPT_ENTRY_ITERATE(loc_cpu_entry, private->size,
cleanup_entry, NULL); cleanup_entry, NULL);
if (private->number > private->initial_entries)
module_put(table_owner);
xt_free_table_info(private); xt_free_table_info(private);
} }
......
...@@ -2095,12 +2095,15 @@ void ipt_unregister_table(struct xt_table *table) ...@@ -2095,12 +2095,15 @@ void ipt_unregister_table(struct xt_table *table)
{ {
struct xt_table_info *private; struct xt_table_info *private;
void *loc_cpu_entry; void *loc_cpu_entry;
struct module *table_owner = table->me;
private = xt_unregister_table(table); private = xt_unregister_table(table);
/* Decrease module usage counts and free resources */ /* Decrease module usage counts and free resources */
loc_cpu_entry = private->entries[raw_smp_processor_id()]; loc_cpu_entry = private->entries[raw_smp_processor_id()];
IPT_ENTRY_ITERATE(loc_cpu_entry, private->size, cleanup_entry, NULL); IPT_ENTRY_ITERATE(loc_cpu_entry, private->size, cleanup_entry, NULL);
if (private->number > private->initial_entries)
module_put(table_owner);
xt_free_table_info(private); xt_free_table_info(private);
} }
......
...@@ -2121,12 +2121,15 @@ void ip6t_unregister_table(struct xt_table *table) ...@@ -2121,12 +2121,15 @@ void ip6t_unregister_table(struct xt_table *table)
{ {
struct xt_table_info *private; struct xt_table_info *private;
void *loc_cpu_entry; void *loc_cpu_entry;
struct module *table_owner = table->me;
private = xt_unregister_table(table); private = xt_unregister_table(table);
/* Decrease module usage counts and free resources */ /* Decrease module usage counts and free resources */
loc_cpu_entry = private->entries[raw_smp_processor_id()]; loc_cpu_entry = private->entries[raw_smp_processor_id()];
IP6T_ENTRY_ITERATE(loc_cpu_entry, private->size, cleanup_entry, NULL); IP6T_ENTRY_ITERATE(loc_cpu_entry, private->size, cleanup_entry, NULL);
if (private->number > private->initial_entries)
module_put(table_owner);
xt_free_table_info(private); xt_free_table_info(private);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment