Commit 2f81814d authored by Pablo Neira Ayuso's avatar Pablo Neira Ayuso Committed by Ziyang Xuan
Browse files

netfilter: nf_tables: disallow rule removal from chain binding

mainline inclusion
from mainline-v6.6-rc3
commit f15f29fd
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I84NFY
CVE: CVE-2023-5197

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=f15f29fd4779be8a418b66e9d52979bb6d6c2325



---------------------------

Chain binding only requires the rule addition/insertion command within
the same transaction. Removal of rules from chain bindings within the
same transaction makes no sense, userspace does not utilize this
feature. Replace nft_chain_is_bound() check to nft_chain_binding() in
rule deletion commands. Replace command implies a rule deletion, reject
this command too.

Rule flush command can also safely rely on this nft_chain_binding()
check because unbound chains are not allowed since 62e1e94b
("netfilter: nf_tables: reject unbound chain set before commit phase").

Fixes: d0e2c7de ("netfilter: nf_tables: add NFT_CHAIN_BINDING")
Reported-by: default avatarKevin Rich <kevinrich1337@gmail.com>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
Conflicts:
	net/netfilter/nf_tables_api.c
Signed-off-by: default avatarZiyang Xuan <william.xuanziyang@huawei.com>
parent e427a81b
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment