summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2019-11-10 11:53:27 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2019-11-10 11:53:27 -0500
commit630faf81b3e61bcc90dc6d8b497800657d2752a5 (patch)
treed3cd6fc1af3908d7c40160ffa9b54474754cda70 /kernel
parent03ad0d703df75c43f78bd72e16124b5b94a95188 (diff)
downloadlinux-630faf81b3e61bcc90dc6d8b497800657d2752a5.tar.bz2
cgroup: don't put ERR_PTR() into fc->root
the caller of ->get_tree() expects NULL left there on error... Reported-by: Thibaut Sautereau <thibaut@sautereau.fr> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cgroup/cgroup.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/cgroup/cgroup.c b/kernel/cgroup/cgroup.c
index 080561bb8a4b..ef4242e5d4bc 100644
--- a/kernel/cgroup/cgroup.c
+++ b/kernel/cgroup/cgroup.c
@@ -2119,11 +2119,12 @@ int cgroup_do_get_tree(struct fs_context *fc)
nsdentry = kernfs_node_dentry(cgrp->kn, sb);
dput(fc->root);
- fc->root = nsdentry;
if (IS_ERR(nsdentry)) {
- ret = PTR_ERR(nsdentry);
deactivate_locked_super(sb);
+ ret = PTR_ERR(nsdentry);
+ nsdentry = NULL;
}
+ fc->root = nsdentry;
}
if (!ctx->kfc.new_sb_created)