From: Kamalesh Babulal Date: Thu, 15 Jun 2023 09:54:06 +0000 (+0530) Subject: wrapper: fix missing unlock() in cgroup_add_all_controllers() X-Git-Tag: v3.1.0~53 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=bdf36c0bd7171c2fab6ba2ec50cef660aa2eb52f;p=thirdparty%2Flibcgroup.git wrapper: fix missing unlock() in cgroup_add_all_controllers() Fix missing unlock(), reported by Coverity tool: CID 313906 (#1 of 1): Missing unlock (LOCK)6. missing_unlock: Returning without unlocking cg_mount_table_lock add the missing pthread_rwlock_unlock() in the error path of the cgroup_add_all_controllers() Fixes: 4124f4d6853a ("wrapper: Add cgroup v2 support to cgroup_add_all_controllers()") Signed-off-by: Kamalesh Babulal Signed-off-by: Tom Hromatka --- diff --git a/src/wrapper.c b/src/wrapper.c index 1ce74e77..547d5054 100644 --- a/src/wrapper.c +++ b/src/wrapper.c @@ -136,6 +136,7 @@ int cgroup_add_all_controllers(struct cgroup *cgroup) pthread_rwlock_rdlock(&cg_mount_table_lock); if (strlen(cg_cgroup_v2_mount_path) == 0) { + pthread_rwlock_unlock(&cg_mount_table_lock); ret = ECGOTHER; goto out; }