Skip to content

Commit

Permalink
cred: add missing return error code when set_cred_ucounts() failed
Browse files Browse the repository at this point in the history
commit 5e6b8a5 upstream.

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

Fixes: 905ae01 ("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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Yang Yingliang authored and gregkh committed Jul 14, 2021
1 parent ce04375 commit 0855952
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion kernel/cred.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down

0 comments on commit 0855952

Please sign in to comment.