Revert "ucounts: Increase ucounts reference counter before the security hook"
This reverts commitb493af3a66which is commitbbb6d0f3e1upstream. The "original" commit905ae01c4a("Add a reference to ucounts for each cred"), should not have been applied to the 5.10.y tree, so revert it, and the follow-on fixup patches as well. Reported-by: "Eric W. Biederman" <ebiederm@xmission.com> Link: https://lore.kernel.org/r/87v93k4bl6.fsf@disp2133 Cc: Alexey Gladkov <legion@kernel.org> Cc: Sasha Levin <sashal@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
@@ -286,11 +286,11 @@ struct cred *prepare_creds(void)
|
||||
new->security = NULL;
|
||||
#endif
|
||||
|
||||
new->ucounts = get_ucounts(new->ucounts);
|
||||
if (!new->ucounts)
|
||||
if (security_prepare_creds(new, old, GFP_KERNEL_ACCOUNT) < 0)
|
||||
goto error;
|
||||
|
||||
if (security_prepare_creds(new, old, GFP_KERNEL_ACCOUNT) < 0)
|
||||
new->ucounts = get_ucounts(new->ucounts);
|
||||
if (!new->ucounts)
|
||||
goto error;
|
||||
|
||||
validate_creds(new);
|
||||
@@ -753,11 +753,11 @@ struct cred *prepare_kernel_cred(struct task_struct *daemon)
|
||||
#ifdef CONFIG_SECURITY
|
||||
new->security = NULL;
|
||||
#endif
|
||||
new->ucounts = get_ucounts(new->ucounts);
|
||||
if (!new->ucounts)
|
||||
if (security_prepare_creds(new, old, GFP_KERNEL_ACCOUNT) < 0)
|
||||
goto error;
|
||||
|
||||
if (security_prepare_creds(new, old, GFP_KERNEL_ACCOUNT) < 0)
|
||||
new->ucounts = get_ucounts(new->ucounts);
|
||||
if (!new->ucounts)
|
||||
goto error;
|
||||
|
||||
put_cred(old);
|
||||
|
||||
Reference in New Issue
Block a user