1

cred: add missing return error code when set_cred_ucounts() failed

If set_cred_ucounts() failed, we need return the error code.

Fixes: 905ae01c4a ("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>
This commit is contained in:
Yang Yingliang 2021-05-26 22:38:05 +08:00 committed by Eric W. Biederman
parent f928ef685d
commit 5e6b8a50a7

View File

@ -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;
}