]> www.infradead.org Git - users/willy/pagecache.git/commit
netfilter: ipset: Fix suspicious rcu_dereference_protected()
authorJozsef Kadlecsik <kadlec@netfilter.org>
Mon, 17 Jun 2024 09:18:15 +0000 (11:18 +0200)
committerPablo Neira Ayuso <pablo@netfilter.org>
Wed, 19 Jun 2024 13:12:56 +0000 (15:12 +0200)
commit8ecd06277a7664f4ef018abae3abd3451d64e7a6
tree2b46c66d08d6c8662446d6950ba6f76d06364ac4
parenta8763466669d21b570b26160d0a5e0a2ee529d22
netfilter: ipset: Fix suspicious rcu_dereference_protected()

When destroying all sets, we are either in pernet exit phase or
are executing a "destroy all sets command" from userspace. The latter
was taken into account in ip_set_dereference() (nfnetlink mutex is held),
but the former was not. The patch adds the required check to
rcu_dereference_protected() in ip_set_dereference().

Fixes: 4e7aaa6b82d6 ("netfilter: ipset: Fix race between namespace cleanup and gc in the list:set type")
Reported-by: syzbot+b62c37cdd58103293a5a@syzkaller.appspotmail.com
Reported-by: syzbot+cfbe1da5fdfc39efc293@syzkaller.appspotmail.com
Reported-by: kernel test robot <oliver.sang@intel.com>
Closes: https://lore.kernel.org/oe-lkp/202406141556.e0b6f17e-lkp@intel.com
Signed-off-by: Jozsef Kadlecsik <kadlec@netfilter.org>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
net/netfilter/ipset/ip_set_core.c