Skip to content

Commit 9ba5c40

Browse files
bwh-ctummakynes
authored andcommitted
netfilter: x_tables: Add note about how to free percpu counters
Due to the way percpu counters are allocated and freed in blocks, it is not safe to free counters individually. Currently all callers do the right thing, but let's note this restriction. Fixes: ae0ac0e ("netfilter: x_tables: pack percpu counter allocations") Signed-off-by: Ben Hutchings <[email protected]> Signed-off-by: Pablo Neira Ayuso <[email protected]>
1 parent c47d36b commit 9ba5c40

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

net/netfilter/x_tables.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1854,7 +1854,9 @@ EXPORT_SYMBOL_GPL(xt_proto_fini);
18541854
* to fetch the real percpu counter.
18551855
*
18561856
* To speed up allocation and improve data locality, a 4kb block is
1857-
* allocated.
1857+
* allocated. Freeing any counter may free an entire block, so all
1858+
* counters allocated using the same state must be freed at the same
1859+
* time.
18581860
*
18591861
* xt_percpu_counter_alloc_state contains the base address of the
18601862
* allocated page and the current sub-offset.

0 commit comments

Comments
 (0)