diff options
author | Yang Yingliang <yangyingliang@huawei.com> | 2021-05-26 16:38:05 +0200 |
---|---|---|
committer | Eric W. Biederman <ebiederm@xmission.com> | 2021-05-28 20:12:52 +0200 |
commit | 5e6b8a50a7cec5686ee2c4bda1d49899c79a7eae (patch) | |
tree | 118191578248a778d2f23ab17f7d3a6fe686cfd9 /kernel/cred.c | |
parent | ucounts: Silence warning in dec_rlimit_ucounts (diff) | |
download | linux-5e6b8a50a7cec5686ee2c4bda1d49899c79a7eae.tar.xz linux-5e6b8a50a7cec5686ee2c4bda1d49899c79a7eae.zip |
cred: add missing return error code when set_cred_ucounts() failed
If set_cred_ucounts() failed, we need return the error code.
Fixes: 905ae01c4ae2 ("Add a reference to ucounts for each cred")
Reported-by: Hulk Robot <hulkci@huawei.com>
Signed-off-by: Yang Yingliang <yangyingliang@huawei.com>
Link: https://lkml.kernel.org/r/20210526143805.2549649-1-yangyingliang@huawei.com
Reviewed-by: Alexey Gladkov <legion@kernel.org>
Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
Diffstat (limited to 'kernel/cred.c')
-rw-r--r-- | kernel/cred.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kernel/cred.c b/kernel/cred.c index dcfa30b337c5..5a1d9702658e 100644 --- a/kernel/cred.c +++ b/kernel/cred.c @@ -372,7 +372,8 @@ int copy_creds(struct task_struct *p, unsigned long clone_flags) ret = create_user_ns(new); if (ret < 0) goto error_put; - if (set_cred_ucounts(new) < 0) + ret = set_cred_ucounts(new); + if (ret < 0) goto error_put; } |