]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: openvswitch: Fix Use-After-Free in ovs_ct_exit
authorHyunwoo Kim <v4bel@theori.io>
Mon, 22 Apr 2024 09:37:17 +0000 (05:37 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 2 May 2024 14:32:38 +0000 (16:32 +0200)
commiteaa5e164a2110d2fb9e16c8a29e4501882235137
tree16aef03e6a4df126383c2bfd1109f9aba6d26c3b
parent36054132dfb0b05e0bf5628b6a805827822c4441
net: openvswitch: Fix Use-After-Free in ovs_ct_exit

[ Upstream commit 5ea7b72d4fac2fdbc0425cd8f2ea33abe95235b2 ]

Since kfree_rcu, which is called in the hlist_for_each_entry_rcu traversal
of ovs_ct_limit_exit, is not part of the RCU read critical section, it
is possible that the RCU grace period will pass during the traversal and
the key will be free.

To prevent this, it should be changed to hlist_for_each_entry_safe.

Fixes: 11efd5cb04a1 ("openvswitch: Support conntrack zone limit")
Signed-off-by: Hyunwoo Kim <v4bel@theori.io>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Reviewed-by: Aaron Conole <aconole@redhat.com>
Link: https://lore.kernel.org/r/ZiYvzQN/Ry5oeFQW@v4bel-B760M-AORUS-ELITE-AX
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/openvswitch/conntrack.c