]> git.ipfire.org Git - thirdparty/ipset.git/commit
netfilter: ipset: fix region locking in hash types
authorJozsef Kadlecsik <kadlec@netfilter.org>
Tue, 6 May 2025 08:26:03 +0000 (10:26 +0200)
committerJozsef Kadlecsik <kadlec@netfilter.org>
Sat, 17 May 2025 13:43:42 +0000 (15:43 +0200)
commit70b372679a0031a03a248e668c17f147c3d83466
treec231485cceed13aacb5289878f6edce85f611ca2
parent7153bdda964fc64e6fa20b8e9e9a9ecfb7f768ca
netfilter: ipset: fix region locking in hash types

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>
kernel/net/netfilter/ipset/ip_set_hash_gen.h