From 69843e810acc27b152c19fe91bb2e9b67f808108 Mon Sep 17 00:00:00 2001 From: Renato Westphal Date: Mon, 31 May 2021 10:27:51 -0300 Subject: [PATCH] ospfd: fix cleanup of MaxAge LSAs on exit During shutdown, the ospf->maxage_lsa table is iterated over to clean up all existing entries. While doing that, route_unlock_node() should be called only for the nodes that have an associated entry, otherwise the table will get corrupted and ospfd will crash. As a side note, using a routing table to store MaxAge LSAs was a very poor choice of a data structure, considering that a simple rb-tree or hash table would get the job done with a much simpler (and less error-prone) API. Something to cleanup in the future... Signed-off-by: Renato Westphal --- ospfd/ospfd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c index 106ce3bd7d..d053bdabbd 100644 --- a/ospfd/ospfd.c +++ b/ospfd/ospfd.c @@ -828,8 +828,8 @@ static void ospf_finish_final(struct ospf *ospf) if ((lsa = rn->info) != NULL) { ospf_lsa_unlock(&lsa); rn->info = NULL; + route_unlock_node(rn); } - route_unlock_node(rn); } route_table_finish(ospf->maxage_lsa); -- 2.39.5