[Devel] [PATCH RHEL7 COMMIT] cgroup: fixed NULL-pointer dereference in cgroup_release_agent

Vasily Averin vvs at virtuozzo.com
Tue Sep 22 10:32:30 MSK 2020


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.27
------>
commit 9c144d0325cefda39adb3736d6f5538e45e778a4
Author: Valeriy Vdovin <valeriy.vdovin at virtuozzo.com>
Date:   Tue Sep 22 10:32:30 2020 +0300

    cgroup: fixed NULL-pointer dereference in cgroup_release_agent
    
    The fix checks that ve->init_task is not referenced during warning
    message decision if ve == ve0, because ve0 init_task is always NULL.
    
    https://jira.sw.ru/browse/PSBM-107673
    Signed-off-by: Valeriy Vdovin <valeriy.vdovin at virtuozzo.com>
---
 kernel/cgroup.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index 691505c..27d7a5e 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -5934,7 +5934,7 @@ void cgroup_release_agent(struct work_struct *work)
 			envp, UMH_WAIT_EXEC, NULL, NULL, NULL);
 
 		ve_task = ve->init_task;
-		if (err < 0 && (!(ve_task->flags & PF_EXITING)))
+		if (err < 0 && (ve == &ve0 || !(ve_task->flags & PF_EXITING)))
 			pr_warn_ratelimited("cgroup release_agent "
 					    "%s %s failed: %d\n",
 					    agentbuf, pathbuf, err);


More information about the Devel mailing list