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 <firstname.lastname@example.org>
Signed-off-by: David Howells <email@example.com>
Acked-by: Paul E. McKenney <firstname.lastname@example.org>
Acked-by: Oleg Nesterov <email@example.com>
Signed-off-by: Linus Torvalds <firstname.lastname@example.org>