diff options
| author | Tejun Heo <tj@kernel.org> | 2016-02-18 11:44:24 -0500 |
|---|---|---|
| committer | Michael Bestas <mkbestas@lineageos.org> | 2022-04-19 00:50:50 +0300 |
| commit | 9362431dd68f6b467cabfb1509a6be2c8a3c43bf (patch) | |
| tree | f099b527b52df641838732657da6367bdcaa5adc /kernel | |
| parent | 4235f35d858d7855ebc7383152cf55e98428d52f (diff) | |
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>
Signed-off-by: Chatur27 <jasonbright2709@gmail.com>
Diffstat (limited to 'kernel')
| -rw-r--r-- | kernel/cgroup.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/kernel/cgroup.c b/kernel/cgroup.c index fc3365d5a94d..32e4c47a161f 100644 --- a/kernel/cgroup.c +++ b/kernel/cgroup.c @@ -6135,10 +6135,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; |
