]> git.ipfire.org Git - thirdparty/libcgroup.git/commit
config: Fix data race reported in cgroup_config_insert_into_mount_table
authorKamalesh Babulal <kamalesh.babulal@oracle.com>
Sun, 26 Jan 2025 06:01:25 +0000 (11:31 +0530)
committerTom Hromatka <tom.hromatka@oracle.com>
Mon, 27 Jan 2025 15:07:25 +0000 (08:07 -0700)
commitb4bc68c302acdb44540e521093bd47b5d48688f8
treee2e439e18a5d1dd350db843cf6260d419559e85a
parent322e81c20f4405e985f03384e6ed329bc0d1b09c
config: Fix data race reported in cgroup_config_insert_into_mount_table

Fix the following data race issue reported by Coverity:

CID 465888: (#1 of 1): 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_mount_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 config_table_index value check too under the
config_table_lock.

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