This is fixed by holding the RCU read lock in wait_task_continued() to ensure
that the task's current credentials aren't destroyed between us reading the
cred pointer and us reading the UID from those credentials.
Furthermore, protect wait_task_stopped() in the same way.
We don't need to keep holding the RCU read lock once we've read the UID from
the credentials as holding the RCU read lock doesn't stop the target task from
changing its creds under us - so the credentials may be outdated immediately
after we've read the pointer, lock or no lock.
Signed-off-by: Daniel J Blueman <email@example.com>
Signed-off-by: David Howells <firstname.lastname@example.org>
Acked-by: Paul E. McKenney <email@example.com>
Acked-by: Oleg Nesterov <firstname.lastname@example.org>
Signed-off-by: Linus Torvalds <email@example.com>