public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: ebiederm@xmission.com (Eric W. Biederman)
To: Sasha Levin <levinsasha928@gmail.com>
Cc: oleg@redhat.com, akpm@linux-foundation.org,
	linux-kernel@vger.kernel.org, davej@redhat.com
Subject: Re: [PATCH] cred: use correct cred accessor with regards to rcu read lock
Date: Thu, 17 May 2012 16:54:27 -0600	[thread overview]
Message-ID: <87k40as9jw.fsf@xmission.com> (raw)
In-Reply-To: <1337290299-11057-1-git-send-email-levinsasha928@gmail.com> (Sasha Levin's message of "Thu, 17 May 2012 23:31:39 +0200")

Sasha Levin <levinsasha928@gmail.com> writes:

> Commit "userns: Convert setting and getting uid and gid system calls to use
> kuid and kgid has modified the accessors in wait_task_continued() and
> wait_task_stopped() to use __task_cred() instead of task_uid().
>
> __task_cred() assumes that we're inside a rcu read lock, which is untrue
> for these two functions.
>
> Modify it to use task_uid() instead.

Thanks applied.

Eric


> Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
> ---
>  kernel/exit.c |    4 ++--
>  1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/kernel/exit.c b/kernel/exit.c
> index 6818cbb..7e54635 100644
> --- a/kernel/exit.c
> +++ b/kernel/exit.c
> @@ -1455,7 +1455,7 @@ static int wait_task_stopped(struct wait_opts *wo,
>  	if (!unlikely(wo->wo_flags & WNOWAIT))
>  		*p_code = 0;
>  
> -	uid = from_kuid_munged(current_user_ns(), __task_cred(p)->uid);
> +	uid = from_kuid_munged(current_user_ns(), task_uid(p));
>  unlock_sig:
>  	spin_unlock_irq(&p->sighand->siglock);
>  	if (!exit_code)
> @@ -1528,7 +1528,7 @@ static int wait_task_continued(struct wait_opts *wo, struct task_struct *p)
>  	}
>  	if (!unlikely(wo->wo_flags & WNOWAIT))
>  		p->signal->flags &= ~SIGNAL_STOP_CONTINUED;
> -	uid = from_kuid_munged(current_user_ns(), __task_cred(p)->uid);
> +	uid = from_kuid_munged(current_user_ns(), task_uid(p));
>  	spin_unlock_irq(&p->sighand->siglock);
>  
>  	pid = task_pid_vnr(p);

      reply	other threads:[~2012-05-17 22:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-17 21:31 [PATCH] cred: use correct cred accessor with regards to rcu read lock Sasha Levin
2012-05-17 22:54 ` Eric W. Biederman [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k40as9jw.fsf@xmission.com \
    --to=ebiederm@xmission.com \
    --cc=akpm@linux-foundation.org \
    --cc=davej@redhat.com \
    --cc=levinsasha928@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox