]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
src/config: Fix data race reported by Coverity
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Sun, 19 Jan 2025 05:48:02 +0000 (11:18 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Fri, 24 Jan 2025 14:27:08 +0000 (07:27 -0700)
commit322e81c20f4405e985f03384e6ed329bc0d1b09c
treea0e2a07d3824e4c7e17936266f3cce2c753de69c
parent9155a813ff1837ec5287ca7fb26706479dbb8390
src/config: Fix data race reported by Coverity

Fix the following data race issue reported by Coverity:

CID 465888:Check of thread-shared field evades lock acquisition
(LOCK_EVASION):

"The data guarded by this critical section may be read while in an
inconsistent state or modified by multiple racing threads.

In cgroup_config_insert_into_namespace_table: Checking the value of a
thread-shared field outside of a locked region to determine if a locked
operation involving that thread shared field has completed."

Fix it by moving the namespace_table_index value check too under the
namespace_table_lock

Signed-off-by: Kamalesh Babulal <kamalesh.babulal@oracle.com>
Signed-off-by: Tom Hromatka <tom.hromatka@oracle.com>
src/config.c