[RHEL7,COMMIT] cgroup: add missing dput() in cgroup_unmark_ve_roots()

Submitted by Vasily Averin on Aug. 29, 2020, 7:20 a.m.

Details

Message ID 202008290720.07T7K2Pv012738@vz7build.vvs.sw.ru
State New
Series "cgroup: add missing dput() in cgroup_unmark_ve_roots()"
Headers show

Commit Message

Vasily Averin Aug. 29, 2020, 7:20 a.m.
The commit is pushed to "branch-rh7-3.10.0-1127.18.2.vz7.163.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-1127.18.2.vz7.163.14
------>
commit cab13b0bffe532eeec00d0421d573f95dc4a6ef1
Author: Andrey Ryabinin <aryabinin@virtuozzo.com>
Date:   Sat Aug 29 10:20:02 2020 +0300

    cgroup: add missing dput() in cgroup_unmark_ve_roots()
    
    cgroup_unmark_ve_roots() calls dget() on cgroup's dentry but don't
    have the corresponding dput() call. This leads to leaking cgroups.
    
    Add missing dput() to fix this.
    
    https://jira.sw.ru/browse/PSBM-107328
    Fixes: 1ac69e183447 ("ve/cgroup: added release_agent to each container root cgroup.")
    Signed-off-by: Andrey Ryabinin <aryabinin@virtuozzo.com>
---
 kernel/cgroup.c | 1 +
 1 file changed, 1 insertion(+)

Patch hide | download patch | download mbox

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 55713a0..5f311180 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -4719,6 +4719,7 @@  void cgroup_unmark_ve_roots(struct ve_struct *ve)
 		mutex_lock(&inode->i_mutex);
 		mutex_lock(&cgroup_mutex);
 		cgroup_rm_file(cgrp, cft);
+		dput(cgrp->dentry);
 		BUG_ON(!rcu_dereference_protected(cgrp->ve_owner,
 				lockdep_is_held(&cgroup_mutex)));
 		rcu_assign_pointer(cgrp->ve_owner, NULL);