[Devel] [PATCH 9/9] ebtables: cleanup table entries during table unregister

Alexey Dobriyan adobriyan at gmail.com
Thu Jul 31 18:42:30 PDT 2008


So far table could be unregistered only during module unload.
Which didn't happen, because depending on table entries, module was
pinned enough times to prevent unload at all.

Now table will be unregistered during netns stop, so prevent module
refcount leaks by cleaning up table entries at table unregister time.

Signed-off-by: Alexey Dobriyan <adobriyan at gmail.com>
---

 net/bridge/netfilter/ebtables.c |    2 ++
 1 file changed, 2 insertions(+)

--- a/net/bridge/netfilter/ebtables.c
+++ b/net/bridge/netfilter/ebtables.c
@@ -1262,6 +1262,8 @@ void ebt_unregister_table(struct ebt_table *table)
 	mutex_lock(&ebt_mutex);
 	list_del(&table->list);
 	mutex_unlock(&ebt_mutex);
+	EBT_ENTRY_ITERATE(table->private->entries, table->private->entries_size,
+			  ebt_cleanup_entry, NULL);
 	vfree(table->private->entries);
 	if (table->private->chainstack) {
 		for_each_possible_cpu(i)
-- 
1.5.4.5


_______________________________________________
Containers mailing list
Containers at lists.linux-foundation.org
https://lists.linux-foundation.org/mailman/listinfo/containers




More information about the Devel mailing list