commit e4d272948d25b66d86fc241cefd95281bfb1079e Author: Pablo Neira Ayuso Date: Wed Mar 31 22:19:51 2021 +0200 netfilter: nf_tables: use-after-free Signed-off-by: Pablo Neira Ayuso diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index 5dd4bb7cabf5..01674c0d9103 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c @@ -8063,6 +8063,8 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb) net->nft.gencursor = nft_gencursor_next(net); list_for_each_entry_safe(trans, next, &net->nft.commit_list, list) { + nf_tables_commit_audit_collect(&adl, trans->ctx.table, + trans->msg_type); switch (trans->msg_type) { case NFT_MSG_NEWTABLE: if (nft_trans_table_update(trans)) { @@ -8211,8 +8213,6 @@ static int nf_tables_commit(struct net *net, struct sk_buff *skb) } break; } - nf_tables_commit_audit_collect(&adl, trans->ctx.table, - trans->msg_type); } nft_commit_notify(net, NETLINK_CB(skb).portid);