get_pid_cred(): proper locking around pid_task

This commit is contained in:
Balazs Gerofi
2016-12-25 17:17:03 +09:00
parent 3565959af7
commit e7af537452

View File

@ -248,9 +248,11 @@ get_pid_cred(int pid)
{
struct task_struct *task = NULL;
if(pid > 0){
if (pid > 0) {
rcu_read_lock();
task = pid_task(find_vpid(pid), PIDTYPE_PID);
if(task){
rcu_read_unlock();
if (task) {
return __task_cred(task);
}
}