]> git.ipfire.org Git - thirdparty/freeradius-server.git/commitdiff
Add needed lock/unlock to access t->inst->list (CID 1551705)
authorJames Jones <jejones3141@gmail.com>
Mon, 22 Jan 2024 22:36:16 +0000 (16:36 -0600)
committerArran Cudbard-Bell <a.cudbardb@freeradius.org>
Thu, 25 Jan 2024 19:48:30 +0000 (13:48 -0600)
src/modules/rlm_stats/rlm_stats.c

index 2f40237a7d9e83e4d3f9b30d2b5bfa473d5468ca..5d8eebb419d0e1f925bd439dc51defef9b5236c3 100644 (file)
@@ -130,6 +130,7 @@ static void coalesce(uint64_t final_stats[FR_RADIUS_CODE_MAX], rlm_stats_thread_
         *      Loop over all of the other thread instances, locking
         *      them, and adding their statistics in.
         */
+       pthread_mutex_lock(&t->mutex);
        for (other = fr_dlist_head(&t->inst->list);
             other != NULL;
             other = fr_dlist_next(&t->inst->list, other)) {
@@ -153,6 +154,7 @@ static void coalesce(uint64_t final_stats[FR_RADIUS_CODE_MAX], rlm_stats_thread_
 
                pthread_mutex_unlock(&other->mutex);
        }
+       pthread_mutex_unlock(&t->mutex);
 }