summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Herrmann <dh.herrmann@gmail.com>2013-10-20 18:37:27 +0200
committerDavid Herrmann <dh.herrmann@gmail.com>2013-10-20 18:48:33 +0200
commitb4cb0b594d55c09a54fc76d26834e38598518dd2 (patch)
treeb6a8c92eae5b331362f4a6ccde353828483dccfb
parentda688d3e640d3db1f1226e70cb2b8c115a79febb (diff)
drm: zap mmaps for dead devicesdrmrevoke
Once a DRM device is unregistered, user-space must not access any existing mmaps, anymore. As we cannot rely on this, we now zap all of them in drm_dev_unregister(). Any driver which wants to support that needs to protect their fault() and mmap() handlers via drm_dev_get_active(), otherwise users can create new mmaps after/during drm_dev_unregister(). Signed-off-by: David Herrmann <dh.herrmann@gmail.com>
-rw-r--r--drivers/gpu/drm/drm_stub.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index e363b72e6ad2..274a0051a73e 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -602,6 +602,10 @@ void drm_dev_unregister(struct drm_device *dev)
drm_dev_shutdown(dev);
+ /* zap all memory mappings (drm_global_mutex must not be locked) */
+ if (dev->dev_mapping)
+ unmap_mapping_range(dev->dev_mapping, 0, LLONG_MAX, 1);
+
/* We cannot hold drm_global_mutex during drm_dev_shutdown() as it might
* dead-lock. Hence, there's a small race between drm_dev_shutdown() and
* us locking drm_global_mutex which drm_release() might trigger. To fix