Loading
netfilter: ipset: Fix suspicious rcu_dereference_protected()
stable inclusion from stable-v6.6.36 commit 94dd411c18d7fff9e411555d5c662d29416501e4 category: bugfix bugzilla: https://gitee.com/src-openeuler/kernel/issues/IACQJH CVE: CVE-2024-39503 Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=94dd411c18d7fff9e411555d5c662d29416501e4 --------------------------- [ Upstream commit 8ecd06277a7664f4ef018abae3abd3451d64e7a6 ] 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> Signed-off-by:
Sasha Levin <sashal@kernel.org> Signed-off-by:
Liu Jian <liujian56@huawei.com>