From ea3b1bb866afba100f51709c388ad915a8c3e00f Mon Sep 17 00:00:00 2001 From: David Carlier Date: Sat, 14 Feb 2026 13:24:00 +0000 Subject: [PATCH] BUG/MINOR: deviceatlas: fix double-checked locking race in checkinst In da_haproxy_checkinst(), base[0] was checked before acquiring the lock but not re-checked after. Another thread could have already processed the reload between the initial check and the lock acquisition, leading to a race condition. This should be backported to lower branches. --- addons/deviceatlas/da.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/addons/deviceatlas/da.c b/addons/deviceatlas/da.c index 24b513592..88caefa8b 100644 --- a/addons/deviceatlas/da.c +++ b/addons/deviceatlas/da.c @@ -280,6 +280,10 @@ static void da_haproxy_checkinst(void) da_property_decl_t extraprops[1] = {{NULL, 0}}; #ifdef USE_THREAD HA_SPIN_LOCK(OTHER_LOCK, &dadwsch_lock); + if (base[0] == 0) { + HA_SPIN_UNLOCK(OTHER_LOCK, &dadwsch_lock); + return; + } #endif strlcpy2(atlasp, base + sizeof(char), sizeof(atlasp)); jsonp = fopen(atlasp, "r"); -- 2.47.3