Skip to content
Commit 0e8cb911 authored by Hyunwoo Kim's avatar Hyunwoo Kim Committed by Zhengchao Shao
Browse files

net: openvswitch: Fix Use-After-Free in ovs_ct_exit

stable inclusion
from stable-v4.19.313
commit 2db9a8c0a01fa1c762c1e61a13c212c492752994
category: bugfix
bugzilla: https://gitee.com/src-openeuler/kernel/issues/I9O0MV
CVE: CVE-2024-27395

Reference: https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/commit/?id=2db9a8c0a01fa1c762c1e61a13c212c492752994



--------------------------------

[ 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: 11efd5cb ("openvswitch: Support conntrack zone limit")
Signed-off-by: default avatarHyunwoo Kim <v4bel@theori.io>
Reviewed-by: default avatarEric Dumazet <edumazet@google.com>
Reviewed-by: default avatarAaron Conole <aconole@redhat.com>
Link: https://lore.kernel.org/r/ZiYvzQN/Ry5oeFQW@v4bel-B760M-AORUS-ELITE-AX


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>

Conflicts:
	net/openvswitch/conntrack.c
[The conflict occurs because commit 27de77ce("net: openvswitch:
ovs_ct_exit to be done under ovs_lock") is not merged.]
Signed-off-by: default avatarZhengchao Shao <shaozhengchao@huawei.com>
parent c6c0f64f
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment