Skip to content

Commit c4fdaba

Browse files
committed
netfilter: nf_tables: don't write table validation state without mutex
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=2189550 Upstream Status: commit 9a32e98 commit 9a32e98 Author: Florian Westphal <fw@strlen.de> Date: Thu Apr 13 17:13:19 2023 +0200 netfilter: nf_tables: don't write table validation state without mutex The ->cleanup callback needs to be removed, this doesn't work anymore as the transaction mutex is already released in the ->abort function. Just do it after a successful validation pass, this either happens from commit or abort phases where transaction mutex is held. Fixes: f102d66 ("netfilter: nf_tables: use dedicated mutex to guard transactions") Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org> Signed-off-by: Florian Westphal <fwestpha@redhat.com>
1 parent 05445b5 commit c4fdaba

File tree

3 files changed

+2
-9
lines changed

3 files changed

+2
-9
lines changed

include/linux/netfilter/nfnetlink.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ struct nfnetlink_subsystem {
4545
int (*commit)(struct net *net, struct sk_buff *skb);
4646
int (*abort)(struct net *net, struct sk_buff *skb,
4747
enum nfnl_abort_action action);
48-
void (*cleanup)(struct net *net);
4948
bool (*valid_genid)(struct net *net, u32 genid);
5049
};
5150

net/netfilter/nf_tables_api.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8383,6 +8383,8 @@ static int nf_tables_validate(struct net *net)
83838383
if (nft_table_validate(net, table) < 0)
83848384
return -EAGAIN;
83858385
}
8386+
8387+
nft_validate_state_update(net, NFT_VALIDATE_SKIP);
83868388
break;
83878389
}
83888390

@@ -9254,11 +9256,6 @@ static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action)
92549256
return 0;
92559257
}
92569258

9257-
static void nf_tables_cleanup(struct net *net)
9258-
{
9259-
nft_validate_state_update(net, NFT_VALIDATE_SKIP);
9260-
}
9261-
92629259
static int nf_tables_abort(struct net *net, struct sk_buff *skb,
92639260
enum nfnl_abort_action action)
92649261
{
@@ -9292,7 +9289,6 @@ static const struct nfnetlink_subsystem nf_tables_subsys = {
92929289
.cb = nf_tables_cb,
92939290
.commit = nf_tables_commit,
92949291
.abort = nf_tables_abort,
9295-
.cleanup = nf_tables_cleanup,
92969292
.valid_genid = nf_tables_valid_genid,
92979293
.owner = THIS_MODULE,
92989294
};

net/netfilter/nfnetlink.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,6 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh,
590590
goto replay_abort;
591591
}
592592
}
593-
if (ss->cleanup)
594-
ss->cleanup(net);
595593

596594
nfnl_err_deliver(&err_list, oskb);
597595
kfree_skb(skb);

0 commit comments

Comments
 (0)