Skip to content

Commit 133b73d

Browse files
ummakynesgregkh
authored andcommitted
netfilter: nfnetlink: skip error delivery on batch in case of ENOMEM
[ Upstream commit a1a64a1 ] If caller reports ENOMEM, then stop iterating over the batch and send a single netlink message to userspace to report OOM. Fixes: cbb8125 ("netfilter: nfnetlink: deliver netlink errors on batch completion") Signed-off-by: Pablo Neira Ayuso <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent e4188f8 commit 133b73d

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

net/netfilter/nfnetlink.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,8 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh,
528528
* processed, this avoids that the same error is
529529
* reported several times when replaying the batch.
530530
*/
531-
if (nfnl_err_add(&err_list, nlh, err, &extack) < 0) {
531+
if (err == -ENOMEM ||
532+
nfnl_err_add(&err_list, nlh, err, &extack) < 0) {
532533
/* We failed to enqueue an error, reset the
533534
* list of errors and send OOM to userspace
534535
* pointing to the batch header.

0 commit comments

Comments
 (0)