diff mbox

[5/5] drm/exynos: Fix potential NULL pointer dereference

Message ID 1353642119-10253-6-git-send-email-sachin.kamat@linaro.org
State Accepted
Headers show

Commit Message

Sachin Kamat Nov. 23, 2012, 3:41 a.m. UTC
Pointer was being dereferenced after freeing.

Fixes the following error:
drivers/gpu/drm/exynos/exynos_drm_g2d.c:323 g2d_userptr_put_dma_addr() error:
dereferencing freed memory 'g2d_userptr'

Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
---
 drivers/gpu/drm/exynos/exynos_drm_g2d.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

Comments

대인기/Tizen Platform Lab(SR)/삼성전자 Nov. 23, 2012, 7:08 a.m. UTC | #1
This was my missing point. Applied.

Thanks,
Inki Dae

> -----Original Message-----
> From: Sachin Kamat [mailto:sachin.kamat@linaro.org]
> Sent: Friday, November 23, 2012 12:42 PM
> To: dri-devel@lists.freedesktop.org
> Cc: inki.dae@samsung.com; jy0922.shim@samsung.com; airlied@linux.ie;
> sachin.kamat@linaro.org; patches@linaro.org
> Subject: [PATCH 5/5] drm/exynos: Fix potential NULL pointer dereference
> 
> Pointer was being dereferenced after freeing.
> 
> Fixes the following error:
> drivers/gpu/drm/exynos/exynos_drm_g2d.c:323 g2d_userptr_put_dma_addr()
> error:
> dereferencing freed memory 'g2d_userptr'
> 
> Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
> ---
>  drivers/gpu/drm/exynos/exynos_drm_g2d.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c
> b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
> index c1054cb..6ffa076 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
> @@ -319,8 +319,8 @@ out:
>  	g2d_userptr->sgt = NULL;
> 
>  	kfree(g2d_userptr->pages);
> -	kfree(g2d_userptr);
>  	g2d_userptr->pages = NULL;
> +	kfree(g2d_userptr);
>  	g2d_userptr = NULL;
>  }
> 
> --
> 1.7.4.1
diff mbox

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_drm_g2d.c b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
index c1054cb..6ffa076 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_g2d.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_g2d.c
@@ -319,8 +319,8 @@  out:
 	g2d_userptr->sgt = NULL;
 
 	kfree(g2d_userptr->pages);
-	kfree(g2d_userptr);
 	g2d_userptr->pages = NULL;
+	kfree(g2d_userptr);
 	g2d_userptr = NULL;
 }