All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/i915: Only free the unpin_work if cancelled before being run
@ 2012-04-17  9:29 Chris Wilson
  2012-04-17  9:47 ` Daniel Vetter
  2012-04-17  9:53 ` Chris Wilson
  0 siblings, 2 replies; 7+ messages in thread
From: Chris Wilson @ 2012-04-17  9:29 UTC (permalink / raw)
  To: intel-gfx

The unpin worker frees it work struct and so during intel_crtc_disable
we should only also free the work struct if cancel_work_sync() reports
that it successfully cancelled the work prior to it being executed and
thus avoid the double free.

The impact is only for people unloading modules during a fullscreen game
or movie playback, so extremely small.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
---
 drivers/gpu/drm/i915/intel_display.c |    4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 8298b72..78390e8 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -7602,10 +7602,8 @@ static void intel_crtc_destroy(struct drm_crtc *crtc)
 	intel_crtc->unpin_work = NULL;
 	spin_unlock_irqrestore(&dev->event_lock, flags);
 
-	if (work) {
-		cancel_work_sync(&work->work);
+	if (work && cancel_work_sync(&work->work))
 		kfree(work);
-	}
 
 	drm_crtc_cleanup(crtc);
 
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2012-04-17 13:44 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-04-17  9:29 [PATCH] drm/i915: Only free the unpin_work if cancelled before being run Chris Wilson
2012-04-17  9:47 ` Daniel Vetter
2012-04-17  9:53 ` Chris Wilson
2012-04-17 10:33   ` Daniel Vetter
2012-04-17 13:30     ` Chris Wilson
2012-04-17 13:44       ` Daniel Vetter
2012-04-17 13:45         ` Daniel Vetter

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.