Merge tag 'drm-misc-next-2023-09-27' of git://anongit.freedesktop.org/drm/drm-misc...
[linux-2.6-microblaze.git] / drivers / gpu / drm / amd / amdgpu / amdgpu_gem.c
index ca4d2d4..a1b15d0 100644 (file)
@@ -962,6 +962,7 @@ static int amdgpu_debugfs_gem_info_show(struct seq_file *m, void *unused)
        list_for_each_entry(file, &dev->filelist, lhead) {
                struct task_struct *task;
                struct drm_gem_object *gobj;
+               struct pid *pid;
                int id;
 
                /*
@@ -971,8 +972,9 @@ static int amdgpu_debugfs_gem_info_show(struct seq_file *m, void *unused)
                 * Therefore, we need to protect this ->comm access using RCU.
                 */
                rcu_read_lock();
-               task = pid_task(file->pid, PIDTYPE_TGID);
-               seq_printf(m, "pid %8d command %s:\n", pid_nr(file->pid),
+               pid = rcu_dereference(file->pid);
+               task = pid_task(pid, PIDTYPE_TGID);
+               seq_printf(m, "pid %8d command %s:\n", pid_nr(pid),
                           task ? task->comm : "<unknown>");
                rcu_read_unlock();