[Devel] [PATCH 1/3 v2 RHEL7] ve/cgroup: change resource release order in ve_drop_context
Valeriy Vdovin
valeriy.vdovin at virtuozzo.com
Thu Oct 29 14:00:42 MSK 2020
This fixes 87cb5fdb5b5c77ac617b46a0fe118a7d50a77b1c
In the mentioned patch in cgroup_show_options ve->ve_ns is checked to
ensure that ve->root_css_set is usable. But in ve_drop_context
root_css_set is being released before ve_ns, which is a bug.
root_css_set will now be set to NULL after ve_ns is released.
This reordering only affects the described piece of code in
cgroup_show_options.
https://jira.sw.ru/browse/PSBM-121438
Signed-off-by: Valeriy Vdovin <valeriy.vdovin at virtuozzo.com>
---
kernel/ve/ve.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/kernel/ve/ve.c b/kernel/ve/ve.c
index db26cbd4..f61b1fe 100644
--- a/kernel/ve/ve.c
+++ b/kernel/ve/ve.c
@@ -595,9 +595,6 @@ static void ve_drop_context(struct ve_struct *ve)
struct nsproxy *ve_ns = ve->ve_ns;
struct net *net = ve->ve_netns;
- put_css_set_taskexit(ve->root_css_set);
- ve->root_css_set = NULL;
-
ve->ve_netns = NULL;
put_net(net);
@@ -606,6 +603,9 @@ static void ve_drop_context(struct ve_struct *ve)
synchronize_rcu();
put_nsproxy(ve_ns);
+ put_css_set_taskexit(ve->root_css_set);
+ ve->root_css_set = NULL;
+
ve_hook_iterate_fini(VE_SHUTDOWN_CHAIN, ve);
put_cred(ve->init_cred);
--
1.8.3.1
More information about the Devel
mailing list