Skip to content

Commit 0030879

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: nfnetlink: allow commit to fail
->commit() cannot fail at the moment. Followup-patch adds kmalloc calls in the commit phase, so we'll need to be able to handle errors. Make it so that -EGAIN causes a full replay, and make other errors cause the transaction to fail. Failing is ok from a consistency point of view as long as we perform all actions that could return an error before we increment the generation counter and the base seq. Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent 1ac89d2 commit 0030879

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

net/netfilter/nfnetlink.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,14 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh,
441441
kfree_skb(skb);
442442
goto replay;
443443
} else if (status == NFNL_BATCH_DONE) {
444-
ss->commit(net, oskb);
444+
err = ss->commit(net, oskb);
445+
if (err == -EAGAIN) {
446+
status |= NFNL_BATCH_REPLAY;
447+
goto done;
448+
} else if (err) {
449+
ss->abort(net, oskb);
450+
netlink_ack(oskb, nlmsg_hdr(oskb), err, NULL);
451+
}
445452
} else {
446453
ss->abort(net, oskb);
447454
}

0 commit comments

Comments
 (0)