Commit 9a32e985 authored by Florian Westphal's avatar Florian Westphal Committed by Pablo Neira Ayuso

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: f102d66b ("netfilter: nf_tables: use dedicated mutex to guard transactions")
Signed-off-by: default avatarFlorian Westphal <fw@strlen.de>
Signed-off-by: default avatarPablo Neira Ayuso <pablo@netfilter.org>
parent 63e9bbbc
...@@ -45,7 +45,6 @@ struct nfnetlink_subsystem { ...@@ -45,7 +45,6 @@ struct nfnetlink_subsystem {
int (*commit)(struct net *net, struct sk_buff *skb); int (*commit)(struct net *net, struct sk_buff *skb);
int (*abort)(struct net *net, struct sk_buff *skb, int (*abort)(struct net *net, struct sk_buff *skb,
enum nfnl_abort_action action); enum nfnl_abort_action action);
void (*cleanup)(struct net *net);
bool (*valid_genid)(struct net *net, u32 genid); bool (*valid_genid)(struct net *net, u32 genid);
}; };
......
...@@ -8639,6 +8639,8 @@ static int nf_tables_validate(struct net *net) ...@@ -8639,6 +8639,8 @@ static int nf_tables_validate(struct net *net)
if (nft_table_validate(net, table) < 0) if (nft_table_validate(net, table) < 0)
return -EAGAIN; return -EAGAIN;
} }
nft_validate_state_update(net, NFT_VALIDATE_SKIP);
break; break;
} }
...@@ -9578,11 +9580,6 @@ static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action) ...@@ -9578,11 +9580,6 @@ static int __nf_tables_abort(struct net *net, enum nfnl_abort_action action)
return 0; return 0;
} }
static void nf_tables_cleanup(struct net *net)
{
nft_validate_state_update(net, NFT_VALIDATE_SKIP);
}
static int nf_tables_abort(struct net *net, struct sk_buff *skb, static int nf_tables_abort(struct net *net, struct sk_buff *skb,
enum nfnl_abort_action action) enum nfnl_abort_action action)
{ {
...@@ -9616,7 +9613,6 @@ static const struct nfnetlink_subsystem nf_tables_subsys = { ...@@ -9616,7 +9613,6 @@ static const struct nfnetlink_subsystem nf_tables_subsys = {
.cb = nf_tables_cb, .cb = nf_tables_cb,
.commit = nf_tables_commit, .commit = nf_tables_commit,
.abort = nf_tables_abort, .abort = nf_tables_abort,
.cleanup = nf_tables_cleanup,
.valid_genid = nf_tables_valid_genid, .valid_genid = nf_tables_valid_genid,
.owner = THIS_MODULE, .owner = THIS_MODULE,
}; };
......
...@@ -590,8 +590,6 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh, ...@@ -590,8 +590,6 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh,
goto replay_abort; goto replay_abort;
} }
} }
if (ss->cleanup)
ss->cleanup(net);
nfnl_err_deliver(&err_list, oskb); nfnl_err_deliver(&err_list, oskb);
kfree_skb(skb); kfree_skb(skb);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment