From: Patrick McHardy Date: Thu, 9 Jan 2014 18:42:41 +0000 (+0000) Subject: netfilter: nf_tables: prohibit deletion of a table with existing sets X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=44a6f0df039ee7ddeebc88327dd61f0afb53baa7;p=linux-beck.git netfilter: nf_tables: prohibit deletion of a table with existing sets We currently leak the set memory when deleting a table that still has sets in it. Return EBUSY when attempting to delete a table with sets. Signed-off-by: Patrick McHardy Signed-off-by: Pablo Neira Ayuso --- diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index c35261496c30..36add31e08e7 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -467,7 +467,7 @@ static int nf_tables_deltable(struct sock *nlsk, struct sk_buff *skb, if (IS_ERR(table)) return PTR_ERR(table); - if (table->use) + if (!list_empty(&table->chains) || !list_empty(&table->sets)) return -EBUSY; list_del(&table->list);