From mboxrd@z Thu Jan 1 00:00:00 1970 From: Daniel Vetter Subject: Re: [PATCH] drm/i915: Only free the unpin_work if cancelled before being run Date: Tue, 17 Apr 2012 11:47:38 +0200 Message-ID: <20120417094738.GD4104@phenom.ffwll.local> References: <1334654978-16021-1-git-send-email-chris@chris-wilson.co.uk> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail-ey0-f177.google.com (mail-ey0-f177.google.com [209.85.215.177]) by gabe.freedesktop.org (Postfix) with ESMTP id 7BCC1A08E3 for ; Tue, 17 Apr 2012 02:46:42 -0700 (PDT) Received: by eaak13 with SMTP id k13so1532622eaa.36 for ; Tue, 17 Apr 2012 02:46:41 -0700 (PDT) Content-Disposition: inline In-Reply-To: <1334654978-16021-1-git-send-email-chris@chris-wilson.co.uk> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org Errors-To: intel-gfx-bounces+gcfxdi-intel-gfx=m.gmane.org@lists.freedesktop.org To: Chris Wilson Cc: intel-gfx@lists.freedesktop.org List-Id: intel-gfx@lists.freedesktop.org On Tue, Apr 17, 2012 at 10:29:38AM +0100, Chris Wilson wrote: > The unpin worker frees it work struct and so during intel_crtc_disable s/disable/destroy/ > 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 Reviewed-by: Daniel Vetter > --- > 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 > > _______________________________________________ > Intel-gfx mailing list > Intel-gfx@lists.freedesktop.org > http://lists.freedesktop.org/mailman/listinfo/intel-gfx -- Daniel Vetter Mail: daniel@ffwll.ch Mobile: +41 (0)79 365 57 48