Merge pull request #14894 from louis-6wind/bestpath-heap

bgpd: fix bgp_best_selection heap-use-after-free
This commit is contained in:
Donatas Abraitis 2023-11-29 10:44:16 +02:00 committed by GitHub
commit e6e846de23
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2824,18 +2824,18 @@ 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)) {
dest = bgp_path_info_reap(dest, pi);
assert(dest);
}
if (debug)
zlog_debug(
"%s: %pBD(%s) pi from %s in holddown",
__func__, dest, bgp->name_pretty,
pi->peer->host);
if (CHECK_FLAG(pi->flags, BGP_PATH_REMOVED) &&
(pi != old_select)) {
dest = bgp_path_info_reap(dest, pi);
assert(dest);
}
continue;
}