Skip to content

Commit 26e9c36

Browse files
committed
net: openvswitch: Fix Use-After-Free in ovs_ct_exit
jira LE-1907 cve CVE-2024-27395 Rebuild_History Non-Buildable kernel-4.18.0-553.16.1.el8_10 commit-author Hyunwoo Kim <[email protected]> commit 5ea7b72 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: 11efd5c ("openvswitch: Support conntrack zone limit") Signed-off-by: Hyunwoo Kim <[email protected]> Reviewed-by: Eric Dumazet <[email protected]> Reviewed-by: Aaron Conole <[email protected]> Link: https://lore.kernel.org/r/ZiYvzQN/Ry5oeFQW@v4bel-B760M-AORUS-ELITE-AX Signed-off-by: Jakub Kicinski <[email protected]> (cherry picked from commit 5ea7b72) Signed-off-by: Jonathan Maple <[email protected]>
1 parent d8ea396 commit 26e9c36

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/openvswitch/conntrack.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1916,9 +1916,9 @@ static void ovs_ct_limit_exit(struct net *net, struct ovs_net *ovs_net)
19161916
for (i = 0; i < CT_LIMIT_HASH_BUCKETS; ++i) {
19171917
struct hlist_head *head = &info->limits[i];
19181918
struct ovs_ct_limit *ct_limit;
1919+
struct hlist_node *next;
19191920

1920-
hlist_for_each_entry_rcu(ct_limit, head, hlist_node,
1921-
lockdep_ovsl_is_held())
1921+
hlist_for_each_entry_safe(ct_limit, next, head, hlist_node)
19221922
kfree_rcu(ct_limit, rcu);
19231923
}
19241924
kfree(info->limits);

0 commit comments

Comments
 (0)