All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm/ttm: fix ttm_bo_add_ttm(user) failure path
@ 2011-08-22 21:17 Marcin Slusarz
  2011-08-23  6:13 ` Thomas Hellstrom
  0 siblings, 1 reply; 2+ messages in thread
From: Marcin Slusarz @ 2011-08-22 21:17 UTC (permalink / raw)
  To: dri-devel; +Cc: Thomas Hellstrom

ttm_tt_destroy kfrees passed object, so we need to nullify
a reference to it.

Signed-off-by: Marcin Slusarz <marcin.slusarz@gmail.com>
Cc: stable@kernel.org
---
 drivers/gpu/drm/ttm/ttm_bo.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
index 251df77..2e8f929 100644
--- a/drivers/gpu/drm/ttm/ttm_bo.c
+++ b/drivers/gpu/drm/ttm/ttm_bo.c
@@ -353,8 +353,10 @@ static int ttm_bo_add_ttm(struct ttm_buffer_object *bo, bool zero_alloc)
 
 		ret = ttm_tt_set_user(bo->ttm, current,
 				      bo->buffer_start, bo->num_pages);
-		if (unlikely(ret != 0))
+		if (unlikely(ret != 0)) {
 			ttm_tt_destroy(bo->ttm);
+			bo->ttm = NULL;
+		}
 		break;
 	default:
 		printk(KERN_ERR TTM_PFX "Illegal buffer object type\n");
-- 
1.7.6

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

* Re: [PATCH] drm/ttm: fix ttm_bo_add_ttm(user) failure path
  2011-08-22 21:17 [PATCH] drm/ttm: fix ttm_bo_add_ttm(user) failure path Marcin Slusarz
@ 2011-08-23  6:13 ` Thomas Hellstrom
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Hellstrom @ 2011-08-23  6:13 UTC (permalink / raw)
  To: Marcin Slusarz; +Cc: dri-devel

Reviewed-by: Thomas Hellstrom <thellstrom@vmware.com>

On 08/22/2011 11:17 PM, Marcin Slusarz wrote:
> ttm_tt_destroy kfrees passed object, so we need to nullify
> a reference to it.
>
> Signed-off-by: Marcin Slusarz<marcin.slusarz@gmail.com>
> Cc: stable@kernel.org
> ---
>   drivers/gpu/drm/ttm/ttm_bo.c |    4 +++-
>   1 files changed, 3 insertions(+), 1 deletions(-)
>
> diff --git a/drivers/gpu/drm/ttm/ttm_bo.c b/drivers/gpu/drm/ttm/ttm_bo.c
> index 251df77..2e8f929 100644
> --- a/drivers/gpu/drm/ttm/ttm_bo.c
> +++ b/drivers/gpu/drm/ttm/ttm_bo.c
> @@ -353,8 +353,10 @@ static int ttm_bo_add_ttm(struct ttm_buffer_object *bo, bool zero_alloc)
>
>   		ret = ttm_tt_set_user(bo->ttm, current,
>   				      bo->buffer_start, bo->num_pages);
> -		if (unlikely(ret != 0))
> +		if (unlikely(ret != 0)) {
>   			ttm_tt_destroy(bo->ttm);
> +			bo->ttm = NULL;
> +		}
>   		break;
>   	default:
>   		printk(KERN_ERR TTM_PFX "Illegal buffer object type\n");
>    

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

end of thread, other threads:[~2011-08-23  6:14 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-08-22 21:17 [PATCH] drm/ttm: fix ttm_bo_add_ttm(user) failure path Marcin Slusarz
2011-08-23  6:13 ` Thomas Hellstrom

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.