Skip to content

Commit 27709a1

Browse files
committed
netfilter: nf_tables: release flow rule object from commit path
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2134544 Upstream Status: commit 26b5934 commit 26b5934 Author: Pablo Neira Ayuso <pablo@netfilter.org> Date: Wed Oct 26 09:54:45 2022 +0200 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> Signed-off-by: Florian Westphal <fwestpha@redhat.com>
1 parent 549aaf2 commit 27709a1

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
@@ -8322,9 +8322,6 @@ static void nft_commit_release(struct nft_trans *trans)
83228322
nf_tables_chain_destroy(&trans->ctx);
83238323
break;
83248324
case NFT_MSG_DELRULE:
8325-
if (trans->ctx.chain->flags & NFT_CHAIN_HW_OFFLOAD)
8326-
nft_flow_rule_destroy(nft_trans_flow_rule(trans));
8327-
83288325
nf_tables_rule_destroy(&trans->ctx, nft_trans_rule(trans));
83298326
break;
83308327
case NFT_MSG_DELSET:
@@ -8781,6 +8778,9 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb)
87818778
nft_rule_expr_deactivate(&trans->ctx,
87828779
nft_trans_rule(trans),
87838780
NFT_TRANS_COMMIT);
8781+
8782+
if (trans->ctx.chain->flags & NFT_CHAIN_HW_OFFLOAD)
8783+
nft_flow_rule_destroy(nft_trans_flow_rule(trans));
87848784
break;
87858785
case NFT_MSG_NEWSET:
87868786
nft_clear(net, nft_trans_set(trans));

0 commit comments

Comments
 (0)