]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net/xen-netback: prevent UAF in xenvif_flush_hash()
authorJeongjun Park <aha310510@gmail.com>
Thu, 22 Aug 2024 18:11:09 +0000 (03:11 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 17 Oct 2024 13:11:24 +0000 (15:11 +0200)
commita0465723b8581cad27164c9073fd780904cd22d4
tree3c7a8c710d325bd0443aeb65906db6c57ee8f221
parentd107d63e6635daf8360682e6ef037e73fb2b683b
net/xen-netback: prevent UAF in xenvif_flush_hash()

[ Upstream commit 0fa5e94a1811d68fbffa0725efe6d4ca62c03d12 ]

During the list_for_each_entry_rcu iteration call of xenvif_flush_hash,
kfree_rcu does not exist inside the rcu read critical section, so if
kfree_rcu is called when the rcu grace period ends during the iteration,
UAF occurs when accessing head->next after the entry becomes free.

Therefore, to solve this, you need to change it to list_for_each_entry_safe.

Signed-off-by: Jeongjun Park <aha310510@gmail.com>
Link: https://patch.msgid.link/20240822181109.2577354-1-aha310510@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/xen-netback/hash.c