mirror of
https://github.com/hardkernel/linux.git
synced 2026-03-26 12:30:23 +09:00
netfilter: nf_tables: reject unbound chain set before commit phase
[ Upstream commit62e1e94b24] Use binding list to track set transaction and to check for unbound chains before entering the commit phase. Bail out if chain binding remain unused before entering the commit step. Fixes:d0e2c7de92("netfilter: nf_tables: add NFT_CHAIN_BINDING") Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
2938e7d582
commit
2f2f9eaa6d
@@ -372,6 +372,11 @@ static void nft_trans_commit_list_add_tail(struct net *net, struct nft_trans *tr
|
||||
nft_set_is_anonymous(nft_trans_set(trans)))
|
||||
list_add_tail(&trans->binding_list, &nft_net->binding_list);
|
||||
break;
|
||||
case NFT_MSG_NEWCHAIN:
|
||||
if (!nft_trans_chain_update(trans) &&
|
||||
nft_chain_binding(nft_trans_chain(trans)))
|
||||
list_add_tail(&trans->binding_list, &nft_net->binding_list);
|
||||
break;
|
||||
}
|
||||
|
||||
list_add_tail(&trans->list, &nft_net->commit_list);
|
||||
@@ -8908,6 +8913,14 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb)
|
||||
return -EINVAL;
|
||||
}
|
||||
break;
|
||||
case NFT_MSG_NEWCHAIN:
|
||||
if (!nft_trans_chain_update(trans) &&
|
||||
nft_chain_binding(nft_trans_chain(trans)) &&
|
||||
!nft_trans_chain_bound(trans)) {
|
||||
pr_warn_once("nftables ruleset with unbound chain\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user