]> git.puffer.fish Git - mirror/frr.git/commitdiff
bgpd: Ensure ibuf count is protected by mutex
authorDonald Sharp <sharpd@nvidia.com>
Wed, 15 Jan 2025 18:26:58 +0000 (13:26 -0500)
committerMergify <37929162+mergify[bot]@users.noreply.github.com>
Thu, 6 Feb 2025 16:16:48 +0000 (16:16 +0000)
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>
(cherry picked from commit f94ad538cf93d2b18fa4181e8508f08f94f0a2cc)

bgpd/bgp_fsm.c

index c7b7f9e284893ac386a756de8301b20cce1dbe69..c7a4c6928adf2ba9f788658d3340722159e936e4 100644 (file)
@@ -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);