netfilter: nf_tables: fix oops when deleting a chain with references
Subsystems (2)
PATCH 1/1 netfilter: nf_tables: fix oops when deleting a chain with references
commit 780f57420cdac84eabec388868678ede19f7d682
Author: Patrick McHardy <[email protected]> Date: Fri Jan 24 13:23:52 2014 +0000
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
net/netfilter/nf_tables_api.c +1 -1
@@ -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);
Quoted 15 lines · Patrick McHardy
commit
780f57420cdac84eabec388868678ede19f7d682Author: Patrick McHardy <[email protected]> Date: Fri Jan 24 13:23:52 2014 +0000netfilter:
nf_tables: fix oops when deleting a chain with referencesTHe 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
Quoted 2 lines
We need to check the chain use counter before allowing destruction since we might have references from sets or jump rules.
Applied, thanks Patrick.