drm: avoid blocking in drm_clients_info's rcu section
authorjsg <jsg@openbsd.org>
Mon, 27 Sep 2021 03:23:16 +0000 (03:23 +0000)
committerjsg <jsg@openbsd.org>
Mon, 27 Sep 2021 03:23:16 +0000 (03:23 +0000)
From Desmond Cheong Zhi Xi
54e51d288b38377e8cd645a83e1ad08cc9d20ccc in linux 5.10.y/5.10.67
5eff9585de220cdd131237f5665db5e6c6bdf590 in mainline linux

sys/dev/pci/drm/drm_debugfs.c

index 4d36104..0fb8b2b 100644 (file)
@@ -91,6 +91,7 @@ static int drm_clients_info(struct seq_file *m, void *data)
        mutex_lock(&dev->filelist_mutex);
        list_for_each_entry_reverse(priv, &dev->filelist, lhead) {
                struct task_struct *task;
+               bool is_current_master = drm_is_current_master(priv);
 
                rcu_read_lock(); /* locks pid_task()->comm */
                task = pid_task(priv->pid, PIDTYPE_PID);
@@ -99,7 +100,7 @@ static int drm_clients_info(struct seq_file *m, void *data)
                           task ? task->comm : "<unknown>",
                           pid_vnr(priv->pid),
                           priv->minor->index,
-                          drm_is_current_master(priv) ? 'y' : 'n',
+                          is_current_master ? 'y' : 'n',
                           priv->authenticated ? 'y' : 'n',
                           from_kuid_munged(seq_user_ns(m), uid),
                           priv->magic);