lkml.org 
[lkml]   [2023]   [Jan]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[RFC 05/12] drm/cgroup: Allow safe external access to file_priv
Date
From: Tvrtko Ursulin <tvrtko.ursulin@intel.com>

Entry points from the cgroup subsystem into the drm cgroup controller will
need to walk the file_priv structures associated with registered clients
and since those are not RCU protected lets add a hack for now to make this
safe.

Signed-off-by: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
---
drivers/gpu/drm/drm_cgroup.c | 7 +++++++
1 file changed, 7 insertions(+)

diff --git a/drivers/gpu/drm/drm_cgroup.c b/drivers/gpu/drm/drm_cgroup.c
index d91512a560ff..46b012d2be42 100644
--- a/drivers/gpu/drm/drm_cgroup.c
+++ b/drivers/gpu/drm/drm_cgroup.c
@@ -18,6 +18,13 @@ __del_clients(struct drm_pid_clients *clients,
if (atomic_dec_and_test(&clients->num)) {
xa_erase(&drm_pid_clients, pid);
kfree_rcu(clients, rcu);
+
+ /*
+ * FIXME: file_priv is not RCU protected so we add this hack
+ * to avoid any races with code which walks clients->file_list
+ * and accesses file_priv.
+ */
+ synchronize_rcu();
}
}

--
2.34.1
\
 
 \ /
  Last update: 2023-03-26 23:38    [W:0.234 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site