WSL2-Linux-Kernel/include/net/netfilter
Florian Westphal d7c5f8bd12 netfilter: nf_tables: allow clone callbacks to sleep
commit fa23e0d4b756d25829e124d6b670a4c6bbd4bf7e upstream.

Sven Auhagen reports transaction failures with following error:
  ./main.nft:13:1-26: Error: Could not process rule: Cannot allocate memory
  percpu: allocation failed, size=16 align=8 atomic=1, atomic alloc failed, no space left

This points to failing pcpu allocation with GFP_ATOMIC flag.
However, transactions happen from user context and are allowed to sleep.

One case where we can call into percpu allocator with GFP_ATOMIC is
nft_counter expression.

Normally this happens from control plane, so this could use GFP_KERNEL
instead.  But one use case, element insertion from packet path,
needs to use GFP_ATOMIC allocations (nft_dynset expression).

At this time, .clone callbacks always use GFP_ATOMIC for this reason.

Add gfp_t argument to the .clone function and pass GFP_KERNEL or
GFP_ATOMIC flag depending on context, this allows all clone memory
allocations to sleep for the normal (transaction) case.

Cc: Sven Auhagen <sven.auhagen@voleatech.de>
Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2024-08-19 05:45:50 +02:00
..
ipv4
ipv6 netfilter: conntrack: fix boot failure with nf_conntrack.enable_hooks=1 2021-09-28 13:04:55 +02:00
br_netfilter.h
nf_conntrack.h netfilter: let reset rules clean out conntrack entries 2024-03-06 14:38:46 +00:00
nf_conntrack_acct.h
nf_conntrack_bridge.h
nf_conntrack_core.h netfilter: conntrack: re-fetch conntrack after insertion 2022-06-06 08:43:38 +02:00
nf_conntrack_count.h
nf_conntrack_ecache.h netfilter: ecache: remove nf_exp_event_notifier structure 2021-08-25 12:50:38 +02:00
nf_conntrack_expect.h
nf_conntrack_extend.h
nf_conntrack_helper.h netfilter: conntrack: Add and use nf_ct_set_auto_assign_helper_warned() 2022-04-08 14:23:42 +02:00
nf_conntrack_l4proto.h netfilter: conntrack: pass hook state to log functions 2021-06-18 14:47:43 +02:00
nf_conntrack_labels.h
nf_conntrack_seqadj.h
nf_conntrack_synproxy.h
nf_conntrack_timeout.h
nf_conntrack_timestamp.h
nf_conntrack_tuple.h
nf_conntrack_zones.h
nf_dup_netdev.h
nf_flow_table.h netfilter: flowtable: validate pppoe header 2024-04-27 17:05:24 +02:00
nf_hooks_lwtunnel.h netfilter: add netfilter hooks to SRv6 data plane 2021-08-30 01:51:36 +02:00
nf_log.h
nf_nat.h
nf_nat_helper.h
nf_nat_masquerade.h
nf_nat_redirect.h netfilter: nft_redir: use `struct nf_nat_range2` throughout and deduplicate eval call-backs 2023-11-20 11:08:29 +01:00
nf_queue.h netfilter: nf_queue: fix possible use-after-free 2022-03-08 19:12:45 +01:00
nf_reject.h
nf_socket.h
nf_synproxy.h
nf_tables.h netfilter: nf_tables: allow clone callbacks to sleep 2024-08-19 05:45:50 +02:00
nf_tables_core.h netfilter: nft_payload: move struct nft_payload_set definition where it belongs 2024-06-16 13:39:50 +02:00
nf_tables_ipv4.h netfilter: nf_tables: convert pktinfo->tprot_set to flags field 2022-07-12 16:34:55 +02:00
nf_tables_ipv6.h netfilter: nf_tables: convert pktinfo->tprot_set to flags field 2022-07-12 16:34:55 +02:00
nf_tables_offload.h netfilter: nf_tables: bail out early if hardware offload is not supported 2022-06-14 18:36:17 +02:00
nf_tproxy.h netfilter: tproxy: fix deadlock due to missing BH disable 2023-03-17 08:48:55 +01:00
nft_fib.h
nft_meta.h
nft_reject.h
xt_rateest.h