]> git.puffer.fish Git - matthieu/frr.git/commit
bgpd: Fix several use after free's in bgp for the peer
authorDonald Sharp <sharpd@nvidia.com>
Thu, 1 Dec 2022 18:12:40 +0000 (13:12 -0500)
committerDonald Sharp <sharpd@nvidia.com>
Mon, 5 Dec 2022 14:11:21 +0000 (09:11 -0500)
commit69ef3f3136ead5be13ce6b49bdad65052c282f9b
tree94d9828cd9c78001e69e84cf6aefa1be13721a0a
parent40f67286f7e271ca2f66fb2a3680d30e33913ec3
bgpd: Fix several use after free's in bgp for the peer

Three fixes:

a) When calling bgp_fsm_change_status with `Deleted` do
not add a new event to the peer's t_event because
we are already in the process of deleting everything

b) When bgp_stop decides to delete a peer return a notification
that it is happening to bgp_event_update so that it does not
set the peer state back to idle or do other processing.

c) bgp_event_update can cause a peer deletion, because
the peer can be deleted in the fsm function but the peer
data structure is still pointed to and used after words.
So lock the peer before entering and prevent a use after
free.

Signed-off-by: Donald Sharp <sharpd@nvidia.com>
bgpd/bgp_fsm.c