From: Donald Sharp Date: Wed, 15 Jan 2025 18:26:58 +0000 (-0500) Subject: bgpd: Ensure ibuf count is protected by mutex X-Git-Tag: docker/10.3.0~41^2~1 X-Git-Url: https://git.puffer.fish/?a=commitdiff_plain;h=edfcf0662b7199220ed44e5dabefefb631f058e7;p=mirror%2Ffrr.git bgpd: Ensure ibuf count is protected by mutex Grab the count of streams in ibuf when it is protected by a mutex. Since this data is written to it in another pthread. Signed-off-by: Donald Sharp (cherry picked from commit f94ad538cf93d2b18fa4181e8508f08f94f0a2cc) --- diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c index c7b7f9e284..c7a4c6928a 100644 --- a/bgpd/bgp_fsm.c +++ b/bgpd/bgp_fsm.c @@ -525,8 +525,9 @@ static void bgp_holdtime_timer(struct event *thread) * for systems where we are heavily loaded for one * reason or another. */ - inq_count = atomic_load_explicit(&connection->ibuf->count, - memory_order_relaxed); + frr_with_mutex (&connection->io_mtx) { + inq_count = atomic_load_explicit(&connection->ibuf->count, memory_order_relaxed); + } if (inq_count) BGP_TIMER_ON(connection->t_holdtime, bgp_holdtime_timer, peer->v_holdtime);