From c955a3cbeced0539b3dbb12bb1c235b264f0d6b6 Mon Sep 17 00:00:00 2001 From: Donald Sharp Date: Sun, 10 Sep 2023 09:51:34 -0400 Subject: [PATCH] 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 --- bgpd/bgp_route.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bgpd/bgp_route.c b/bgpd/bgp_route.c index d745f8cb78..367398e5fd 100644 --- a/bgpd/bgp_route.c +++ b/bgpd/bgp_route.c @@ -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( -- 2.39.5