diff mbox

[xf86-video,2/2] dri: fix leakage of FB when closing the screen

Message ID 1346412711-4257-2-git-send-email-imre.deak@intel.com (mailing list archive)
State Not Applicable
Headers show

Commit Message

Imre Deak Aug. 31, 2012, 11:31 a.m. UTC
Calling drmModeRmFB is only allowed in DRM master mode. Since leaving
the VT also drops master mode we need to remove the FB before calling
I830LeaveVT.

This is only a real leak in case of a server reset, otherwise the server
process will exit anyway and the kernel will clean up the FB.

Signed-off-by: Imre Deak <imre.deak@intel.com>
---
 src/intel_driver.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Chris Wilson Sept. 5, 2012, 10:19 a.m. UTC | #1
On Fri, 31 Aug 2012 14:31:51 +0300, Imre Deak <imre.deak@intel.com> wrote:
> Calling drmModeRmFB is only allowed in DRM master mode. Since leaving
> the VT also drops master mode we need to remove the FB before calling
> I830LeaveVT.
> 
> This is only a real leak in case of a server reset, otherwise the server
> process will exit anyway and the kernel will clean up the FB.

Your reasoning is sound and the new location of leave_vt did not scare
me...

Thanks, pushed. I'm not too concerned over simply warning about an
unfixable leak along the anomalous path, though the debug spew in the
kernel for this error is not as obvious as I'd like.
-Chris
diff mbox

Patch

diff --git a/src/intel_driver.c b/src/intel_driver.c
index c5be679..ca8e530 100644
--- a/src/intel_driver.c
+++ b/src/intel_driver.c
@@ -1049,10 +1049,6 @@  static Bool I830CloseScreen(CLOSE_SCREEN_ARGS_DECL)
 	I830UeventFini(scrn);
 #endif
 
-	if (scrn->vtSema == TRUE) {
-		I830LeaveVT(VT_FUNC_ARGS(0));
-	}
-
 	DeleteCallback(&FlushCallback, intel_flush_callback, scrn);
 
 	intel_glamor_close_screen(screen);
@@ -1082,6 +1078,10 @@  static Bool I830CloseScreen(CLOSE_SCREEN_ARGS_DECL)
 		intel->front_buffer = NULL;
 	}
 
+	if (scrn->vtSema == TRUE) {
+		I830LeaveVT(VT_FUNC_ARGS(0));
+	}
+
 	intel_batch_teardown(scrn);
 
 	if (INTEL_INFO(intel)->gen >= 40)