summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaarten Lankhorst <maarten.lankhorst@canonical.com>2013-03-20 17:13:44 +0100
committerMaarten Lankhorst <maarten.lankhorst@canonical.com>2013-03-20 17:13:44 +0100
commita4d1bc43d4d10e2ca1e512c1010e962c587d6c16 (patch)
tree934c9191756501bedd1eba068db8d38bb2328fff /src
parent3cb3ab8704813d7c14b9e547a30e37598d70c85a (diff)
Cleanup drmmode in CloseScreen.
Prevents a use-after-free. Signed-off-by: Maarten Lankhorst <maarten.lankhorst@canonical.com>
Diffstat (limited to 'src')
-rw-r--r--src/drmmode_display.c14
-rw-r--r--src/drmmode_display.h1
-rw-r--r--src/radeon_kms.c1
3 files changed, 16 insertions, 0 deletions
diff --git a/src/drmmode_display.c b/src/drmmode_display.c
index 0d738563..d09c69ce 100644
--- a/src/drmmode_display.c
+++ b/src/drmmode_display.c
@@ -1584,6 +1584,20 @@ void drmmode_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
}
}
+void drmmode_fini(ScrnInfoPtr pScrn, drmmode_ptr drmmode)
+{
+ RADEONEntPtr pRADEONEnt = RADEONEntPriv(pScrn);
+ RADEONInfoPtr info = RADEONPTR(pScrn);
+
+ if (pRADEONEnt->fd_wakeup_registered == serverGeneration &&
+ info->dri2.pKernelDRMVersion->version_minor >= 4) {
+ RemoveGeneralSocket(drmmode->fd);
+ RemoveBlockAndWakeupHandlers((BlockHandlerProcPtr)NoopDDA,
+ drm_wakeup_handler, drmmode);
+ }
+}
+
+
Bool drmmode_set_bufmgr(ScrnInfoPtr pScrn, drmmode_ptr drmmode, struct radeon_bo_manager *bufmgr)
{
drmmode->bufmgr = bufmgr;
diff --git a/src/drmmode_display.h b/src/drmmode_display.h
index 45c33cb3..b63ec8eb 100644
--- a/src/drmmode_display.h
+++ b/src/drmmode_display.h
@@ -99,6 +99,7 @@ typedef struct {
extern Bool drmmode_pre_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int cpp);
extern void drmmode_init(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
+extern void drmmode_fini(ScrnInfoPtr pScrn, drmmode_ptr drmmode);
extern Bool drmmode_set_bufmgr(ScrnInfoPtr pScrn, drmmode_ptr drmmode, struct radeon_bo_manager *bufmgr);
extern void drmmode_set_cursor(ScrnInfoPtr scrn, drmmode_ptr drmmode, int id, struct radeon_bo *bo);
void drmmode_adjust_frame(ScrnInfoPtr pScrn, drmmode_ptr drmmode, int x, int y);
diff --git a/src/radeon_kms.c b/src/radeon_kms.c
index e2474670..f997d8a5 100644
--- a/src/radeon_kms.c
+++ b/src/radeon_kms.c
@@ -1065,6 +1065,7 @@ static Bool RADEONCloseScreen_KMS(CLOSE_SCREEN_ARGS_DECL)
drmDropMaster(info->dri2.drm_fd);
+ drmmode_fini(pScrn, &info->drmmode);
if (info->dri2.enabled)
radeon_dri2_close_screen(pScreen);
drmClose(info->dri2.drm_fd);