diff options
author | Patrick McHardy <kaber@trash.net> | 2014-01-25 03:04:07 -0500 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2014-02-05 07:16:17 -0500 |
commit | 3dd7279fb6db05ec5a088cd0cae6ba22580a82bd (patch) | |
tree | b19de5ae3787470a9e29bfd40627ccfef24e8768 /net | |
parent | 2a53bfb3e0fb6aa6b1ac93e5979a040a4b57ea8b (diff) |
netfilter: nf_tables: fix oops when deleting a chain with references
The following commands trigger an oops:
# nft -i
nft> add table filter
nft> add chain filter input { type filter hook input priority 0; }
nft> add chain filter test
nft> add rule filter input jump test
nft> delete chain filter test
We need to check the chain use counter before allowing destruction since
we might have references from sets or jump rules.
Bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=69341
Reported-by: Matthew Ife <deleriux1@gmail.com>
Tested-by: Matthew Ife <deleriux1@gmail.com>
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Diffstat (limited to 'net')
-rw-r--r-- | net/netfilter/nf_tables_api.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 117bbaaddde6..9ce30534f853 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, | |||
1045 | if (IS_ERR(chain)) | 1045 | if (IS_ERR(chain)) |
1046 | return PTR_ERR(chain); | 1046 | return PTR_ERR(chain); |
1047 | 1047 | ||
1048 | if (!list_empty(&chain->rules)) | 1048 | if (!list_empty(&chain->rules) || chain->use > 0) |
1049 | return -EBUSY; | 1049 | return -EBUSY; |
1050 | 1050 | ||
1051 | list_del(&chain->list); | 1051 | list_del(&chain->list); |