[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220215111033.GG21589@blackbody.suse.cz>
Date: Tue, 15 Feb 2022 12:10:33 +0100
From: Michal Koutný <mkoutny@...e.com>
To: "Eric W. Biederman" <ebiederm@...ssion.com>
Cc: linux-kernel@...r.kernel.org, Alexey Gladkov <legion@...nel.org>,
Kees Cook <keescook@...omium.org>,
Shuah Khan <shuah@...nel.org>,
Christian Brauner <brauner@...nel.org>,
Solar Designer <solar@...nwall.com>,
Ran Xiaokai <ran.xiaokai@....com.cn>,
containers@...ts.linux-foundation.org, stable@...r.kernel.org
Subject: Re: [PATCH 2/8] ucounts: Fix set_cred_ucounts
On Thu, Feb 10, 2022 at 08:13:18PM -0600, "Eric W. Biederman" <ebiederm@...ssion.com> wrote:
> diff --git a/kernel/cred.c b/kernel/cred.c
> index 473d17c431f3..933155c96922 100644
> --- a/kernel/cred.c
> +++ b/kernel/cred.c
> @@ -665,21 +665,16 @@ EXPORT_SYMBOL(cred_fscmp);
>
> int set_cred_ucounts(struct cred *new)
> {
> - struct task_struct *task = current;
> - const struct cred *old = task->real_cred;
> struct ucounts *new_ucounts, *old_ucounts = new->ucounts;
>
> - if (new->user == old->user && new->user_ns == old->user_ns)
> - return 0;
> -
> /*
> * This optimization is needed because alloc_ucounts() uses locks
> * for table lookups.
> */
> - if (old_ucounts->ns == new->user_ns && uid_eq(old_ucounts->uid, new->euid))
> + if (old_ucounts->ns == new->user_ns && uid_eq(old_ucounts->uid, new->uid))
> return 0;
>
> - if (!(new_ucounts = alloc_ucounts(new->user_ns, new->euid)))
> + if (!(new_ucounts = alloc_ucounts(new->user_ns, new->uid)))
> return -EAGAIN;
>
> new->ucounts = new_ucounts;
Reviewed-by: Michal Koutný <mkoutny@...e.com>
Powered by blists - more mailing lists