Showing error 992

User: Jiri Slaby
Error type: Leaving function in locked state
Error type description: Some lock is not unlocked on all paths of a function, so it is leaked
File location: kernel/cgroup.c
Line in file: 1343
Project: Linux Kernel
Project version: 2.6.28
Tools: Stanse (1.2)
Entered: 2012-03-02 21:35:18 UTC


Source:

1313        if (!cgroup_lock_live_group(cgrp))
1314                return -ENODEV;
1315        ret = attach_task_by_pid(cgrp, pid);
1316        cgroup_unlock();
1317        return ret;
1318}
1319
1320/* The various types of files and directories in a cgroup file system */
1321enum cgroup_filetype {
1322        FILE_ROOT,
1323        FILE_DIR,
1324        FILE_TASKLIST,
1325        FILE_NOTIFY_ON_RELEASE,
1326        FILE_RELEASE_AGENT,
1327};
1328
1329/**
1330 * cgroup_lock_live_group - take cgroup_mutex and check that cgrp is alive.
1331 * @cgrp: the cgroup to be checked for liveness
1332 *
1333 * On success, returns true; the lock should be later released with
1334 * cgroup_unlock(). On failure returns false with no lock held.
1335 */
1336bool cgroup_lock_live_group(struct cgroup *cgrp)
1337{
1338        mutex_lock(&cgroup_mutex);
1339        if (cgroup_is_removed(cgrp)) {
1340                mutex_unlock(&cgroup_mutex);
1341                return false;
1342        }
1343        return true;
1344}
1345
1346static int cgroup_release_agent_write(struct cgroup *cgrp, struct cftype *cft,
1347                                      const char *buffer)
1348{
1349        BUILD_BUG_ON(sizeof(cgrp->root->release_agent_path) < PATH_MAX);
1350        if (!cgroup_lock_live_group(cgrp))
1351                return -ENODEV;
1352        strcpy(cgrp->root->release_agent_path, buffer);
1353        cgroup_unlock();
Show full sources