summaryrefslogtreecommitdiffstats
path: root/kernel
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2016-02-18 11:44:24 -0500
committerTejun Heo <tj@kernel.org>2016-02-18 11:44:24 -0500
commitd22025570e2ebfc68819b35c5d457e53d9337217 (patch)
tree49dcdad014b56c6f87a6cc74c528dc7754720d1f /kernel
parent1c53753e0df1ae4d21661053459e7c024a43f1d3 (diff)
downloadop-kernel-dev-d22025570e2ebfc68819b35c5d457e53d9337217.zip
op-kernel-dev-d22025570e2ebfc68819b35c5d457e53d9337217.tar.gz
cgroup: fix alloc_cgroup_ns() error handling in copy_cgroup_ns()
alloc_cgroup_ns() returns an ERR_PTR value on error but copy_cgroup_ns() was checking for NULL for error. Fix it. Signed-off-by: Tejun Heo <tj@kernel.org> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Diffstat (limited to 'kernel')
-rw-r--r--kernel/cgroup.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c
index afb1205..d92d91a 100644
--- a/kernel/cgroup.c
+++ b/kernel/cgroup.c
@@ -6083,10 +6083,11 @@ struct cgroup_namespace *copy_cgroup_ns(unsigned long flags,
spin_unlock_bh(&css_set_lock);
mutex_unlock(&cgroup_mutex);
- err = -ENOMEM;
new_ns = alloc_cgroup_ns();
- if (!new_ns)
+ if (IS_ERR(new_ns)) {
+ err = PTR_ERR(new_ns);
goto err_out;
+ }
new_ns->user_ns = get_user_ns(user_ns);
new_ns->root_cset = cset;
OpenPOWER on IntegriCloud