Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1320451 > unrolled thread

[patch] drm/vmwgfx: fix a NULL dereference

Started byDan Carpenter <dan.carpenter@oracle.com>
First post2016-01-28 10:10 +0100
Last post2016-01-28 10:30 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [patch] drm/vmwgfx: fix a NULL dereference Dan Carpenter <dan.carpenter@oracle.com> - 2016-01-28 10:10 +0100
    Re: [patch] drm/vmwgfx: fix a NULL dereference Daniel Vetter <daniel@ffwll.ch> - 2016-01-28 10:30 +0100

#1320451 — [patch] drm/vmwgfx: fix a NULL dereference

FromDan Carpenter <dan.carpenter@oracle.com>
Date2016-01-28 10:10 +0100
Subject[patch] drm/vmwgfx: fix a NULL dereference
Message-ID<qVQKv-1al-21@gated-at.bofh.it>
We dereference "eaction->event" inside the call to drm_send_event_locked()
so should hold off on setting it to NULL until afterward.

Fixes: fb740cf2492c ("drm: Create drm_send_event helpers")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
index e0edf14..37c305b 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
@@ -880,8 +880,8 @@ static void vmw_event_fence_action_seq_passed(struct vmw_fence_action *action)
 	}
 
 	list_del_init(&eaction->fpriv_head);
-	eaction->event = NULL;
 	drm_send_event_locked(dev, eaction->event);
+	eaction->event = NULL;
 	spin_unlock_irqrestore(&dev->event_lock, irq_flags);
 }
 

[toc] | [next] | [standalone]


#1320466

FromDaniel Vetter <daniel@ffwll.ch>
Date2016-01-28 10:30 +0100
Message-ID<qVR3Q-1j6-17@gated-at.bofh.it>
In reply to#1320451
On Thu, Jan 28, 2016 at 12:06:46PM +0300, Dan Carpenter wrote:
> We dereference "eaction->event" inside the call to drm_send_event_locked()
> so should hold off on setting it to NULL until afterward.
> 
> Fixes: fb740cf2492c ("drm: Create drm_send_event helpers")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Oh dear that's embarassing. Thanks for the patch, applied.
-Daniel

> 
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
> index e0edf14..37c305b 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_fence.c
> @@ -880,8 +880,8 @@ static void vmw_event_fence_action_seq_passed(struct vmw_fence_action *action)
>  	}
>  
>  	list_del_init(&eaction->fpriv_head);
> -	eaction->event = NULL;
>  	drm_send_event_locked(dev, eaction->event);
> +	eaction->event = NULL;
>  	spin_unlock_irqrestore(&dev->event_lock, irq_flags);
>  }
>  

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web