Skip to content

Commit 999c5b6

Browse files
CKI Backport BotHangbin Liu
authored andcommitted
ipv6: fix possible infinite loop in fib6_info_uses_dev()
JIRA: https://issues.redhat.com/browse/RHEL-115578 CVE: CVE-2025-38587 commit f8d8ce1 Author: Eric Dumazet <edumazet@google.com> Date: Fri Jul 25 14:07:24 2025 +0000 ipv6: fix possible infinite loop in fib6_info_uses_dev() fib6_info_uses_dev() seems to rely on RCU without an explicit protection. Like the prior fix in rt6_nlmsg_size(), we need to make sure fib6_del_route() or fib6_add_rt2node() have not removed the anchor from the list, or we risk an infinite loop. Fixes: d9ccb18 ("ipv6: Fix soft lockups in fib6_select_path under high next hop churn") Signed-off-by: Eric Dumazet <edumazet@google.com> Link: https://patch.msgid.link/20250725140725.3626540-4-edumazet@google.com Signed-off-by: Jakub Kicinski <kuba@kernel.org> Signed-off-by: CKI Backport Bot <cki-ci-bot+cki-gitlab-backport-bot@redhat.com>
1 parent ffa319e commit 999c5b6

File tree

1 file changed

+11
-6
lines changed

1 file changed

+11
-6
lines changed

net/ipv6/route.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5875,16 +5875,21 @@ static bool fib6_info_uses_dev(const struct fib6_info *f6i,
58755875
if (f6i->fib6_nh->fib_nh_dev == dev)
58765876
return true;
58775877

5878-
if (f6i->fib6_nsiblings) {
5879-
struct fib6_info *sibling, *next_sibling;
5878+
if (READ_ONCE(f6i->fib6_nsiblings)) {
5879+
const struct fib6_info *sibling;
58805880

5881-
list_for_each_entry_safe(sibling, next_sibling,
5882-
&f6i->fib6_siblings, fib6_siblings) {
5883-
if (sibling->fib6_nh->fib_nh_dev == dev)
5881+
rcu_read_lock();
5882+
list_for_each_entry_rcu(sibling, &f6i->fib6_siblings,
5883+
fib6_siblings) {
5884+
if (sibling->fib6_nh->fib_nh_dev == dev) {
5885+
rcu_read_unlock();
58845886
return true;
5887+
}
5888+
if (!READ_ONCE(f6i->fib6_nsiblings))
5889+
break;
58855890
}
5891+
rcu_read_unlock();
58865892
}
5887-
58885893
return false;
58895894
}
58905895

0 commit comments

Comments
 (0)