Skip to content

Commit 8a3d4c3

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: nf_tables: fail batch if fatal signal is pending
abort batch processing and return so task can exit faster. Otherwise even SIGKILL has no immediate effect. Signed-off-by: Florian Westphal <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent d6501de commit 8a3d4c3

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

net/netfilter/nfnetlink.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
#include <linux/uaccess.h>
2626
#include <net/sock.h>
2727
#include <linux/init.h>
28+
#include <linux/sched/signal.h>
2829

2930
#include <net/netlink.h>
3031
#include <linux/netfilter/nfnetlink.h>
@@ -330,6 +331,13 @@ static void nfnetlink_rcv_batch(struct sk_buff *skb, struct nlmsghdr *nlh,
330331
while (skb->len >= nlmsg_total_size(0)) {
331332
int msglen, type;
332333

334+
if (fatal_signal_pending(current)) {
335+
nfnl_err_reset(&err_list);
336+
err = -EINTR;
337+
status = NFNL_BATCH_FAILURE;
338+
goto done;
339+
}
340+
333341
memset(&extack, 0, sizeof(extack));
334342
nlh = nlmsg_hdr(skb);
335343
err = 0;

0 commit comments

Comments
 (0)