Skip to content

Commit 26b5934

Browse files
committed
netfilter: nf_tables: release flow rule object from commit path
No need to postpone this to the commit release path, since no packets are walking over this object, this is accessed from control plane only. This helped uncovered UAF triggered by races with the netlink notifier. Fixes: 9dd732e ("netfilter: nf_tables: memleak flow rule from commit path") Reported-by: syzbot+8f747f62763bc6c32916@syzkaller.appspotmail.com Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent d4bc827 commit 26b5934

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8465,9 +8465,6 @@ static void nft_commit_release(struct nft_trans *trans)
84658465
nf_tables_chain_destroy(&trans->ctx);
84668466
break;
84678467
case NFT_MSG_DELRULE:
8468-
if (trans->ctx.chain->flags & NFT_CHAIN_HW_OFFLOAD)
8469-
nft_flow_rule_destroy(nft_trans_flow_rule(trans));
8470-
84718468
nf_tables_rule_destroy(&trans->ctx, nft_trans_rule(trans));
84728469
break;
84738470
case NFT_MSG_DELSET:
@@ -8973,6 +8970,9 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb)
89738970
nft_rule_expr_deactivate(&trans->ctx,
89748971
nft_trans_rule(trans),
89758972
NFT_TRANS_COMMIT);
8973+
8974+
if (trans->ctx.chain->flags & NFT_CHAIN_HW_OFFLOAD)
8975+
nft_flow_rule_destroy(nft_trans_flow_rule(trans));
89768976
break;
89778977
case NFT_MSG_NEWSET:
89788978
nft_clear(net, nft_trans_set(trans));

0 commit comments

Comments
 (0)