]> git.puffer.fish Git - matthieu/frr.git/commitdiff
ospf6d: Fix use after free of router in OSPFv3 ABR route calculation. mergify/bp/stable/10.1/pr-18254
authorAcee Lindem <acee@lindem.com>
Mon, 24 Feb 2025 21:44:32 +0000 (21:44 +0000)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Wed, 26 Feb 2025 17:48:49 +0000 (17:48 +0000)
This PR fixes FRR issue https://github.com/FRRouting/frr/issues/18040. The
OSPFv3 route is locked during the ABR calculation since there are
scenarios under which it is freed. The OSPFv3 ABR computation is
sub-optimal and this PR doesn't attempt to rework it.

Signed-off-by: Acee Lindem <acee@lindem.com>
(cherry picked from commit 06af50eacec8660fada0d4fd5cd11f0ade4e3c6c)

ospf6d/ospf6_intra.c

index b06796ada02c3fb2b4e0a947029a723cea0522c5..0d35e8dd3630b34eebac406efd8db28bced08c23 100644 (file)
@@ -2320,9 +2320,15 @@ void ospf6_intra_brouter_calculation(struct ospf6_area *oa)
                                zlog_info("%s: brouter %s appears via area %s",
                                          __func__, brouter_name, oa->name);
 
+                       ospf6_route_lock(brouter);
                        /* newly added */
                        if (hook_add)
                                (*hook_add)(brouter);
+                       if (CHECK_FLAG(brouter->flag, OSPF6_ROUTE_WAS_REMOVED)) {
+                               ospf6_route_unlock(brouter);
+                               brouter = NULL;
+                       } else
+                               ospf6_route_unlock(brouter);
                } else {
                        if (IS_OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_ID(
                                    brouter_id)