Skip to content

Commit

Permalink
bgpd: Ensure ibuf count is protected by mutex
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
donaldsharp committed Jan 17, 2025
1 parent 4b96752 commit f94ad53
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bgpd/bgp_fsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit f94ad53

Please sign in to comment.