Skip to content

Commit 9a32e98

Browse files
Florian Westphalummakynes
authored andcommitted
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 <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 63e9bbb commit 9a32e98

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
@@ -8639,6 +8639,8 @@ static int nf_tables_validate(struct net *net)
86398639
if (nft_table_validate(net, table) < 0)
86408640
return -EAGAIN;
86418641
}
8642+
8643+
nft_validate_state_update(net, NFT_VALIDATE_SKIP);
86428644
break;
86438645
}
86448646

@@ -9578,11 +9580,6 @@ static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action)
95789580
return 0;
95799581
}
95809582

9581-
static void nf_tables_cleanup(struct net *net)
9582-
{
9583-
nft_validate_state_update(net, NFT_VALIDATE_SKIP);
9584-
}
9585-
95869583
static int nf_tables_abort(struct net *net, struct sk_buff *skb,
95879584
enum nfnl_abort_action action)
95889585
{
@@ -9616,7 +9613,6 @@ static const struct nfnetlink_subsystem nf_tables_subsys = {
96169613
.cb = nf_tables_cb,
96179614
.commit = nf_tables_commit,
96189615
.abort = nf_tables_abort,
9619-
.cleanup = nf_tables_cleanup,
96209616
.valid_genid = nf_tables_valid_genid,
96219617
.owner = THIS_MODULE,
96229618
};

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)