summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDonald Sharp <sharpd@nvidia.com>2025-01-15 13:26:58 -0500
committerDonald Sharp <sharpd@nvidia.com>2025-01-17 10:16:48 -0500
commitf94ad538cf93d2b18fa4181e8508f08f94f0a2cc (patch)
treee35d3de3f6205ed7cefd6649a4103961b2886bc8
parent4b967527376db4f08c50f9c32cc77556700d0eec (diff)
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 <sharpd@nvidia.com>
-rw-r--r--bgpd/bgp_fsm.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/bgpd/bgp_fsm.c b/bgpd/bgp_fsm.c
index 0e3ed9f0d1..62b5a84e87 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);