commit 780f57420cdac84eabec388868678ede19f7d682 Author: Patrick McHardy Date: Fri Jan 24 13:23:52 2014 +0000 netfilter: nf_tables: fix oops when deleting a chain with references We need to check the chain use counter before allowing destruction since we might have references from sets or jump rules. Signed-off-by: Patrick McHardy diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 117bbaa..9ce3053 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -1045,7 +1045,7 @@ static int nf_tables_delchain(struct sock *nlsk, struct sk_buff *skb, if (IS_ERR(chain)) return PTR_ERR(chain); - if (!list_empty(&chain->rules)) + if (!list_empty(&chain->rules) || chain->use > 0) return -EBUSY; list_del(&chain->list);