bgpd: bgp_best_selection ensure dest still exists

When reaping the dest ensure that it still exists as that
it should be locked by the calling function.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
This commit is contained in:
Donald Sharp 2023-09-10 09:51:34 -04:00
parent dc01a8ba03
commit c955a3cbec

View File

@ -2815,9 +2815,11 @@ void bgp_best_selection(struct bgp *bgp, struct bgp_dest *dest,
/* reap REMOVED routes, if needs be
* selected route must stay for a while longer though
*/
if (CHECK_FLAG(pi->flags, BGP_PATH_REMOVED)
&& (pi != old_select))
bgp_path_info_reap(dest, pi);
if (CHECK_FLAG(pi->flags, BGP_PATH_REMOVED) &&
(pi != old_select)) {
dest = bgp_path_info_reap(dest, pi);
assert(dest);
}
if (debug)
zlog_debug(