]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
netfilter: ipset: fix region locking in hash types
authorJozsef Kadlecsik <kadlec@netfilter.org>
Wed, 7 May 2025 15:01:59 +0000 (17:01 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 18 May 2025 06:20:35 +0000 (08:20 +0200)
commit82c1eb32693bc48251d92532975e19160987e5b9
treee4a7dbddca8496059744db4c06c56cfa107ee766
parent7ef1fdf42f504e251ec4fe7c2e21cfe94f32fc48
netfilter: ipset: fix region locking in hash types

[ Upstream commit 8478a729c0462273188263136880480729e9efca ]

Region locking introduced in v5.6-rc4 contained three macros to handle
the region locks: ahash_bucket_start(), ahash_bucket_end() which gave
back the start and end hash bucket values belonging to a given region
lock and ahash_region() which should give back the region lock belonging
to a given hash bucket. The latter was incorrect which can lead to a
race condition between the garbage collector and adding new elements
when a hash type of set is defined with timeouts.

Fixes: f66ee0410b1c ("netfilter: ipset: Fix "INFO: rcu detected stall in hash_xxx" reports")
Reported-by: Kota Toda <kota.toda@gmo-cybersecurity.com>
Signed-off-by: Jozsef Kadlecsik <kadlec@netfilter.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/netfilter/ipset/ip_set_hash_gen.h