The commit is pushed to "branch-rh8-4.18.0-305.3.1.vz8.7.x-ovz" and will appear 
at https://src.openvz.org/scm/ovz/vzkernel.git
after rh8-4.18.0-305.3.1.vz8.7.5
------>
commit ed8787ebc4cb7d5d310cb421dc0e0174ea034c13
Author: Pavel Tikhomirov <[email protected]>
Date:   Fri Aug 13 10:17:10 2021 +0300

    cgroup/ve: Fix crash in ve_set_release_agent_path on zero ve_owner
    
    Can be reproduced with:
    
     mount -t cgroup -onone,name=mytestcg,release_agent="/usr/bin/true" \
      cgroup /mnt/mytestcg
    
    Crash happens on BUG() statement in ve_set_release_agent_path.
    
    If we add new cgroup root initially having a release agent ve_owner
    should be initialized before ve_set_release_agent_path.
    
    https://jira.sw.ru/browse/PSBM-131979
    Fixes: 099f87a441bf ("ve/cgroup: Add ve_owner field to cgroup")
    
    Signed-off-by: Pavel Tikhomirov <[email protected]>
---
 kernel/cgroup/cgroup.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 5eb8e72b983e..dcd7983c393f 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -2242,6 +2242,8 @@ void init_cgroup_root(struct cgroup_fs_context *ctx)
        init_cgroup_housekeeping(cgrp);
 
        root->flags = ctx->flags;
+
+       RCU_INIT_POINTER(cgrp->ve_owner, &ve0);
        if (ctx->release_agent)
                ve_set_release_agent_path(cgrp->ve_owner, root,
                                          ctx->release_agent);
@@ -2353,8 +2355,6 @@ int cgroup_do_get_tree(struct fs_context *fc)
        struct cgroup_fs_context *ctx = cgroup_fc2context(fc);
        int ret;
 
-       RCU_INIT_POINTER(ctx->root->cgrp.ve_owner, &ve0);
-
        ctx->kfc.root = ctx->root->kf_root;
        if (fc->fs_type == &cgroup2_fs_type)
                ctx->kfc.magic = CGROUP2_SUPER_MAGIC;
_______________________________________________
Devel mailing list
[email protected]
https://lists.openvz.org/mailman/listinfo/devel

Reply via email to