struct user_namespace *user_ns,
struct cgroup_namespace *old_ns)
{
- struct cgroup_namespace *new_ns = NULL;
- struct css_set *cset = NULL;
- int err;
+ struct cgroup_namespace *new_ns;
+ struct css_set *cset;
BUG_ON(!old_ns);
}
/* Allow only sysadmin to create cgroup namespace. */
- err = -EPERM;
if (!ns_capable(user_ns, CAP_SYS_ADMIN))
- goto err_out;
+ return ERR_PTR(-EPERM);
mutex_lock(&cgroup_mutex);
spin_lock_bh(&css_set_lock);
new_ns = alloc_cgroup_ns();
if (IS_ERR(new_ns)) {
- err = PTR_ERR(new_ns);
- goto err_out;
+ put_css_set(cset);
+ return new_ns;
}
new_ns->user_ns = get_user_ns(user_ns);
new_ns->root_cset = cset;
return new_ns;
-
-err_out:
- if (cset)
- put_css_set(cset);
- kfree(new_ns);
- return ERR_PTR(err);
}
static inline struct cgroup_namespace *to_cg_ns(struct ns_common *ns)