Skip to content

Commit ca2f18b

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: nf_tables: make valid_genid callback mandatory
always call this function, followup patch can use this to aquire a per-netns transaction log to guard the entire batch instead of using the nfnl susbsys mutex (which is shared among all namespaces). Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 452238e commit ca2f18b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

net/netfilter/nf_tables_api.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6591,7 +6591,7 @@ static int nf_tables_abort(struct net *net, struct sk_buff *skb)
65916591

65926592
static bool nf_tables_valid_genid(struct net *net, u32 genid)
65936593
{
6594-
return net->nft.base_seq == genid;
6594+
return genid == 0 || net->nft.base_seq == genid;
65956595
}
65966596

65976597
static const struct nfnetlink_subsystem nf_tables_subsys = {

net/netfilter/nfnetlink.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,13 +331,13 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh,
331331
}
332332
}
333333

334-
if (!ss->commit || !ss->abort) {
334+
if (!ss->valid_genid || !ss->commit || !ss->abort) {
335335
nfnl_unlock(subsys_id);
336336
netlink_ack(oskb, nlh, -EOPNOTSUPP, NULL);
337337
return kfree_skb(skb);
338338
}
339339

340-
if (genid && ss->valid_genid && !ss->valid_genid(net, genid)) {
340+
if (!ss->valid_genid(net, genid)) {
341341
nfnl_unlock(subsys_id);
342342
netlink_ack(oskb, nlh, -ERESTART, NULL);
343343
return kfree_skb(skb);

0 commit comments

Comments
 (0)