]> git.itanic.dy.fi Git - linux-stable/commit
netfilter: nf_tables: fix memleak when more than 255 elements expired
authorFlorian Westphal <fw@strlen.de>
Tue, 19 Sep 2023 13:36:13 +0000 (15:36 +0200)
committerFlorian Westphal <fw@strlen.de>
Wed, 20 Sep 2023 08:35:23 +0000 (10:35 +0200)
commitcf5000a7787cbc10341091d37245a42c119d26c5
tree0914e619889af02133e4a2378693313649fdfa9b
parentc9bd26513b3a11b3adb3c2ed8a31a01a87173ff1
netfilter: nf_tables: fix memleak when more than 255 elements expired

When more than 255 elements expired we're supposed to switch to a new gc
container structure.

This never happens: u8 type will wrap before reaching the boundary
and nft_trans_gc_space() always returns true.

This means we recycle the initial gc container structure and
lose track of the elements that came before.

While at it, don't deref 'gc' after we've passed it to call_rcu.

Fixes: 5f68718b34a5 ("netfilter: nf_tables: GC transaction API to avoid race with control plane")
Reported-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Florian Westphal <fw@strlen.de>
include/net/netfilter/nf_tables.h
net/netfilter/nf_tables_api.c