Skip to content

Commit

Permalink
Merge pull request FRRouting#14304 from donaldsharp/ospf_use_after_fl…
Browse files Browse the repository at this point in the history
…umple

ospfd: Prevent use after free( and crash of ospf ) when no router ospf
  • Loading branch information
Jafaral authored Aug 31, 2023
2 parents c4f606a + 530be6a commit ef8cd78
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions ospfd/ospfd.c
Original file line number Diff line number Diff line change
Expand Up @@ -806,25 +806,6 @@ static void ospf_finish_final(struct ospf *ospf)
ospf_area_free(area);
}

/* Cancel all timers. */
EVENT_OFF(ospf->t_read);
EVENT_OFF(ospf->t_write);
EVENT_OFF(ospf->t_spf_calc);
EVENT_OFF(ospf->t_ase_calc);
EVENT_OFF(ospf->t_maxage);
EVENT_OFF(ospf->t_maxage_walker);
EVENT_OFF(ospf->t_abr_task);
EVENT_OFF(ospf->t_abr_fr);
EVENT_OFF(ospf->t_asbr_check);
EVENT_OFF(ospf->t_asbr_redist_update);
EVENT_OFF(ospf->t_distribute_update);
EVENT_OFF(ospf->t_lsa_refresher);
EVENT_OFF(ospf->t_opaque_lsa_self);
EVENT_OFF(ospf->t_sr_update);
EVENT_OFF(ospf->t_default_routemap_timer);
EVENT_OFF(ospf->t_external_aggr);
EVENT_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)
Expand Down Expand Up @@ -912,8 +893,26 @@ static void ospf_finish_final(struct ospf *ospf)
}
}

route_table_finish(ospf->rt_aggr_tbl);
/* Cancel all timers. */
EVENT_OFF(ospf->t_read);
EVENT_OFF(ospf->t_write);
EVENT_OFF(ospf->t_spf_calc);
EVENT_OFF(ospf->t_ase_calc);
EVENT_OFF(ospf->t_maxage);
EVENT_OFF(ospf->t_maxage_walker);
EVENT_OFF(ospf->t_abr_task);
EVENT_OFF(ospf->t_abr_fr);
EVENT_OFF(ospf->t_asbr_check);
EVENT_OFF(ospf->t_asbr_redist_update);
EVENT_OFF(ospf->t_distribute_update);
EVENT_OFF(ospf->t_lsa_refresher);
EVENT_OFF(ospf->t_opaque_lsa_self);
EVENT_OFF(ospf->t_sr_update);
EVENT_OFF(ospf->t_default_routemap_timer);
EVENT_OFF(ospf->t_external_aggr);
EVENT_OFF(ospf->gr_info.t_grace_period);

route_table_finish(ospf->rt_aggr_tbl);

ospf_free_refresh_queue(ospf);

Expand Down

0 comments on commit ef8cd78

Please sign in to comment.