Commit e2daa24e authored by Taehee Yoo's avatar Taehee Yoo Committed by Stefan Bader

netfilter: nf_tables: use WARN_ON_ONCE instead of BUG_ON in nft_do_chain()

BugLink: https://bugs.launchpad.net/bugs/1784409

commit adc972c5 upstream.

When depth of chain is bigger than NFT_JUMP_STACK_SIZE, the nft_do_chain
crashes. But there is no need to crash hard here.
Suggested-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarTaehee Yoo <ap420073@gmail.com>
Acked-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: default avatarKhalid Elmously <khalid.elmously@canonical.com>
parent be49aba0
...@@ -167,7 +167,8 @@ nft_do_chain(struct nft_pktinfo *pkt, void *priv) ...@@ -167,7 +167,8 @@ nft_do_chain(struct nft_pktinfo *pkt, void *priv)
switch (regs.verdict.code) { switch (regs.verdict.code) {
case NFT_JUMP: case NFT_JUMP:
BUG_ON(stackptr >= NFT_JUMP_STACK_SIZE); if (WARN_ON_ONCE(stackptr >= NFT_JUMP_STACK_SIZE))
return NF_DROP;
jumpstack[stackptr].chain = chain; jumpstack[stackptr].chain = chain;
jumpstack[stackptr].rule = rule; jumpstack[stackptr].rule = rule;
jumpstack[stackptr].rulenum = rulenum; jumpstack[stackptr].rulenum = rulenum;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment