From: Renato Westphal Date: Mon, 31 May 2021 13:27:51 +0000 (-0300) Subject: ospfd: fix cleanup of MaxAge LSAs on exit X-Git-Tag: base_8.1~445^2~5 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=69843e810acc27b152c19fe91bb2e9b67f808108;p=matthieu%2Ffrr.git 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 --- 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);