drm/i915: Initialize obj->pages before use by i915_gem_object_do_bit17_swizzle()
diff mbox

Message ID 1350658266-13158-1-git-send-email-chris@chris-wilson.co.uk
State New, archived
Headers show

Commit Message

Chris Wilson Oct. 19, 2012, 2:51 p.m. UTC
If we leave obj->pages set to NULL before attempting to deswizzle them,
then an OOPS is well deserved.

Fixes regression introduced in commit 9da3da660d8c19a54f6e93361d147509be3fff84
Author: Chris Wilson <chris@chris-wilson.co.uk>
Date:   Fri Jun 1 15:20:22 2012 +0100

    drm/i915: Replace the array of pages with a scatterlist

Reported-by: Krzysztof Kolasa
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Cc: stable@vger.kernel.org
---
 drivers/gpu/drm/i915/i915_gem.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Krzysztof Kolasa Oct. 19, 2012, 4:29 p.m. UTC | #1
On 19.10.2012 16:51, Chris Wilson wrote:
> If we leave obj->pages set to NULL before attempting to deswizzle them,
> then an OOPS is well deserved.
>
> Fixes regression introduced in commit 9da3da660d8c19a54f6e93361d147509be3fff84
> Author: Chris Wilson <chris@chris-wilson.co.uk>
> Date:   Fri Jun 1 15:20:22 2012 +0100
>
>      drm/i915: Replace the array of pages with a scatterlist
>
> Reported-by: Krzysztof Kolasa
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: stable@vger.kernel.org
> ---
>   drivers/gpu/drm/i915/i915_gem.c |    3 ++-
>   1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index ad2ed75..6ab7c68 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1953,10 +1953,11 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj)
>   		sg_set_page(sg, page, PAGE_SIZE, 0);
>   	}
>   
> +	obj->pages = st;
> +
>   	if (i915_gem_object_needs_bit17_swizzle(obj))
>   		i915_gem_object_do_bit_17_swizzle(obj);
>   
> -	obj->pages = st;
>   	return 0;
>   
>   err_pages:
Patch solves the problem.

Thanks.

Krzysztof
Jesse Barnes Oct. 19, 2012, 4:43 p.m. UTC | #2
On Fri, 19 Oct 2012 15:51:06 +0100
Chris Wilson <chris@chris-wilson.co.uk> wrote:

> If we leave obj->pages set to NULL before attempting to deswizzle them,
> then an OOPS is well deserved.
> 
> Fixes regression introduced in commit 9da3da660d8c19a54f6e93361d147509be3fff84
> Author: Chris Wilson <chris@chris-wilson.co.uk>
> Date:   Fri Jun 1 15:20:22 2012 +0100
> 
>     drm/i915: Replace the array of pages with a scatterlist
> 
> Reported-by: Krzysztof Kolasa
> Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
> Cc: stable@vger.kernel.org
> ---
>  drivers/gpu/drm/i915/i915_gem.c |    3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
> index ad2ed75..6ab7c68 100644
> --- a/drivers/gpu/drm/i915/i915_gem.c
> +++ b/drivers/gpu/drm/i915/i915_gem.c
> @@ -1953,10 +1953,11 @@ i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj)
>  		sg_set_page(sg, page, PAGE_SIZE, 0);
>  	}
>  
> +	obj->pages = st;
> +
>  	if (i915_gem_object_needs_bit17_swizzle(obj))
>  		i915_gem_object_do_bit_17_swizzle(obj);
>  
> -	obj->pages = st;
>  	return 0;
>  
>  err_pages:

Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org>

Patch
diff mbox

diff --git a/drivers/gpu/drm/i915/i915_gem.c b/drivers/gpu/drm/i915/i915_gem.c
index ad2ed75..6ab7c68 100644
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1953,10 +1953,11 @@  i915_gem_object_get_pages_gtt(struct drm_i915_gem_object *obj)
 		sg_set_page(sg, page, PAGE_SIZE, 0);
 	}
 
+	obj->pages = st;
+
 	if (i915_gem_object_needs_bit17_swizzle(obj))
 		i915_gem_object_do_bit_17_swizzle(obj);
 
-	obj->pages = st;
 	return 0;
 
 err_pages: