From: James Jones Date: Mon, 22 Jan 2024 22:36:16 +0000 (-0600) Subject: Add needed lock/unlock to access t->inst->list (CID 1551705) X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9c14799fba74566b2ce35b9460d82cd21029bd27;p=thirdparty%2Ffreeradius-server.git Add needed lock/unlock to access t->inst->list (CID 1551705) --- diff --git a/src/modules/rlm_stats/rlm_stats.c b/src/modules/rlm_stats/rlm_stats.c index 2f40237a7d9..5d8eebb419d 100644 --- a/src/modules/rlm_stats/rlm_stats.c +++ b/src/modules/rlm_stats/rlm_stats.c @@ -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); }