From: David Herrmann <dh.herrmann@gmail.com>
To: dri-devel@lists.freedesktop.org
Cc: linux-kernel@vger.kernel.org, Dave Airlie <airlied@gmail.com>,
David Herrmann <dh.herrmann@gmail.com>
Subject: [RFC v2 6/6] drm: zap mmaps for dead devices
Date: Tue, 22 Oct 2013 00:33:28 +0200 [thread overview]
Message-ID: <1382394808-20611-7-git-send-email-dh.herrmann@gmail.com> (raw)
In-Reply-To: <1382394808-20611-1-git-send-email-dh.herrmann@gmail.com>
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>
---
drivers/gpu/drm/drm_stub.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index e363b72..274a005 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
--
1.8.4.1
prev parent reply other threads:[~2013-10-21 22:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-21 22:33 [RFC v2 0/6] DRM revoke support David Herrmann
2013-10-21 22:33 ` [RFC v2 1/6] percpu_rw_semaphore: export symbols for modules David Herrmann
2013-10-21 22:33 ` [RFC v2 2/6] percpu_rw_semaphore: add percpu_down_read_trylock() David Herrmann
2013-10-21 22:33 ` [RFC v2 3/6] drm: split drm_release() David Herrmann
2013-10-21 22:33 ` [RFC v2 4/6] drm: make dev->unplugged reliable David Herrmann
2013-10-21 22:33 ` [RFC v2 5/6] drm: make drm_dev_unregister() immediate David Herrmann
2013-10-21 22:33 ` David Herrmann [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1382394808-20611-7-git-send-email-dh.herrmann@gmail.com \
--to=dh.herrmann@gmail.com \
--cc=airlied@gmail.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome