summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJafar Al-Gharaibeh <jafar@atcorp.com>2023-08-31 11:58:58 -0500
committerGitHub <noreply@github.com>2023-08-31 11:58:58 -0500
commit178a1cb9823bb2bcaf1a301e5a97304bc314aae4 (patch)
tree89e76cb8225ac789db4eba332796e3044dcab95d
parent76e43eab2f82d24c398d5ba545892c6ce97def87 (diff)
parent2f0698dda58482719d207336cb7092388589e8fa (diff)
Merge pull request #14319 from opensourcerouting/fix/backport_530be6a4d089600f1028439ddec420ef651b983b_8.4
ospfd: Prevent use after free( and crash of ospf ) when no router ospf
-rw-r--r--ospfd/ospfd.c37
1 files changed, 18 insertions, 19 deletions
diff --git a/ospfd/ospfd.c b/ospfd/ospfd.c
index 94a5b99ba8..de2da41492 100644
--- a/ospfd/ospfd.c
+++ b/ospfd/ospfd.c
@@ -809,24 +809,6 @@ static void ospf_finish_final(struct ospf *ospf)
ospf_area_free(area);
}
- /* Cancel all timers. */
- THREAD_OFF(ospf->t_read);
- THREAD_OFF(ospf->t_write);
- THREAD_OFF(ospf->t_spf_calc);
- THREAD_OFF(ospf->t_ase_calc);
- THREAD_OFF(ospf->t_maxage);
- THREAD_OFF(ospf->t_maxage_walker);
- THREAD_OFF(ospf->t_abr_task);
- THREAD_OFF(ospf->t_asbr_check);
- THREAD_OFF(ospf->t_asbr_nssa_redist_update);
- THREAD_OFF(ospf->t_distribute_update);
- THREAD_OFF(ospf->t_lsa_refresher);
- THREAD_OFF(ospf->t_opaque_lsa_self);
- THREAD_OFF(ospf->t_sr_update);
- THREAD_OFF(ospf->t_default_routemap_timer);
- THREAD_OFF(ospf->t_external_aggr);
- THREAD_OFF(ospf->gr_info.t_grace_period);
-
LSDB_LOOP (OPAQUE_AS_LSDB(ospf), rn, lsa)
ospf_discard_from_db(ospf, ospf->lsdb, lsa);
LSDB_LOOP (EXTERNAL_LSDB(ospf), rn, lsa)
@@ -910,8 +892,25 @@ static void ospf_finish_final(struct ospf *ospf)
}
}
- route_table_finish(ospf->rt_aggr_tbl);
+ /* Cancel all timers. */
+ THREAD_OFF(ospf->t_read);
+ THREAD_OFF(ospf->t_write);
+ THREAD_OFF(ospf->t_spf_calc);
+ THREAD_OFF(ospf->t_ase_calc);
+ THREAD_OFF(ospf->t_maxage);
+ THREAD_OFF(ospf->t_maxage_walker);
+ THREAD_OFF(ospf->t_abr_task);
+ THREAD_OFF(ospf->t_asbr_check);
+ THREAD_OFF(ospf->t_asbr_nssa_redist_update);
+ THREAD_OFF(ospf->t_distribute_update);
+ THREAD_OFF(ospf->t_lsa_refresher);
+ THREAD_OFF(ospf->t_opaque_lsa_self);
+ THREAD_OFF(ospf->t_sr_update);
+ THREAD_OFF(ospf->t_default_routemap_timer);
+ THREAD_OFF(ospf->t_external_aggr);
+ THREAD_OFF(ospf->gr_info.t_grace_period);
+ route_table_finish(ospf->rt_aggr_tbl);
ospf_free_refresh_queue(ospf);