linux/include
Pablo Neira Ayuso d5f87c1111 netfilter: nf_tables: allow clone callbacks to sleep
commit fa23e0d4b7 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:41:22 +02:00
..
acpi ACPI: APEI: explicit init of HEST and GHES in apci_init() 2023-09-19 12:20:28 +02:00
asm-generic asm-generic: qspinlock: fix queued_spin_value_unlocked() implementation 2023-12-20 15:44:35 +01:00
clocksource
crypto crypto: af_alg - Disallow multiple in-flight AIO requests 2024-01-25 14:37:42 -08:00
drm drm/mipi-dsi: use correct return type for the DSC functions 2024-06-16 13:32:12 +02:00
dt-bindings dt-bindings: clock: Update the videocc resets for sm8150 2024-01-25 14:37:48 -08:00
keys
kunit
kvm KVM: arm64: vgic-v4: Make the doorbell request robust w.r.t preemption 2024-07-05 09:12:56 +02:00
linux Fix gcc 4.9 build issue in 5.10.y 2024-08-19 05:41:22 +02:00
math-emu
media media: cec: core: add adap_nb_transmit_canceled() callback 2024-06-16 13:32:30 +02:00
memory
misc
net netfilter: nf_tables: allow clone callbacks to sleep 2024-08-19 05:41:22 +02:00
pcmcia
ras
rdma RDMA/cma: Always set static rate to 0 for RoCE 2023-06-21 15:45:39 +02:00
scsi scsi: core: Fix a use-after-free 2024-07-27 10:40:22 +02:00
soc soc: fsl: qbman: Add CGR update function 2024-04-13 12:58:36 +02:00
sound ALSA: dmaengine: Synchronize dma channel after drop() 2024-07-27 10:40:19 +02:00
target scsi: target: Fix multiple LUN_RESET handling 2023-05-17 11:47:48 +02:00
trace SUNRPC: Fixup gss_status tracepoint error output 2024-08-19 05:40:51 +02:00
uapi m68k: amiga: Turn off Warp1260 interrupts during boot 2024-08-19 05:40:57 +02:00
vdso
video video: of_display_timing.h: include errno.h 2022-07-12 16:32:19 +02:00
xen ACPI: processor: Fix evaluating _PDC method when running as Xen dom0 2023-05-17 11:47:42 +02:00