Skip to content

Commit 40965e5

Browse files
bgpd: backpressure - Avoid use after free
Coverity complains there is a use after free (1598495 and 1598496) At this point, most likely dest->refcount cannot go 1 and free up the dest, but there might be some code path where this can happen. Fixing this with a simple order change (no harm fix). Ticket :#4001204 Signed-off-by: Rajasekar Raja <rajasekarr@nvidia.com>
1 parent 703beba commit 40965e5

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

bgpd/bgp_evpn.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6339,9 +6339,9 @@ void bgp_evpn_free(struct bgp *bgp, struct bgpevpn *vpn)
63396339
dest = dest_next) {
63406340
dest_next = zebra_announce_next(&bm->zebra_announce_head, dest);
63416341
if (dest->za_vpn == vpn) {
6342+
zebra_announce_del(&bm->zebra_announce_head, dest);
63426343
bgp_path_info_unlock(dest->za_bgp_pi);
63436344
bgp_dest_unlock_node(dest);
6344-
zebra_announce_del(&bm->zebra_announce_head, dest);
63456345
}
63466346
}
63476347

bgpd/bgpd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3954,9 +3954,9 @@ int bgp_delete(struct bgp *bgp)
39543954
dest_next = zebra_announce_next(&bm->zebra_announce_head, dest);
39553955
dest_table = bgp_dest_table(dest);
39563956
if (dest_table->bgp == bgp) {
3957+
zebra_announce_del(&bm->zebra_announce_head, dest);
39573958
bgp_path_info_unlock(dest->za_bgp_pi);
39583959
bgp_dest_unlock_node(dest);
3959-
zebra_announce_del(&bm->zebra_announce_head, dest);
39603960
}
39613961
}
39623962

0 commit comments

Comments
 (0)