mirror of
https://github.com/haproxy/haproxy.git
synced 2026-02-19 02:29:31 -05:00
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.
This commit is contained in:
parent
734a139c52
commit
ea3b1bb866
1 changed files with 4 additions and 0 deletions
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Reference in a new issue