Skip to content

Commit

Permalink
Merge pull request #7330 from donaldsharp/zebra_use_after_free
Browse files Browse the repository at this point in the history
zebra: Fix use after free in debug path
  • Loading branch information
ton31337 authored Oct 17, 2020
2 parents 0dc8647 + 7e26b9d commit f41688b
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion zebra/zebra_rib.c
Original file line number Diff line number Diff line change
Expand Up @@ -2268,9 +2268,18 @@ static void process_subq_route(struct listnode *lnode, uint8_t qindex)
rib_process(rnode);

if (IS_ZEBRA_DEBUG_RIB_DETAILED) {
struct route_entry *re = re_list_first(&dest->routes);
struct route_entry *re = NULL;
char buf[SRCDEST2STR_BUFFER];

/*
* rib_process may have freed the dest
* as part of the garbage collection. Let's
* prevent stupidity from happening.
*/
dest = rib_dest_from_rnode(rnode);
if (dest)
re = re_list_first(&dest->routes);

srcdest_rnode2str(rnode, buf, sizeof(buf));
zlog_debug("%s(%u:%u):%s: rn %p dequeued from sub-queue %u",
zvrf_name(zvrf), zvrf_id(zvrf), re ? re->table : 0, buf,
Expand Down

0 comments on commit f41688b

Please sign in to comment.