[PATCH 3/3] drm/tegra: gem: Check before freeing CMA memory

Sean Paul seanpaul at chromium.org
Thu Nov 6 11:11:41 PST 2014


On Thu, Nov 6, 2014 at 10:57 AM, Thierry Reding
<thierry.reding at gmail.com> wrote:
> From: Thierry Reding <treding at nvidia.com>
>
> dma_free_writecombine() must not be called on a buffer that couldn't be
> allocated. Check for a valid virtual address before attempting to free
> the memory to avoid a crash.
>
> Reported-by: Sean Paul <seanpaul at google.com>

nit: I'd prefer to use seanpaul at chromium.org instead of my google.com address


> Signed-off-by: Thierry Reding <treding at nvidia.com>

Reviewed-by: Sean Paul <seanpaul at chromium.org>

> ---
>  drivers/gpu/drm/tegra/gem.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/tegra/gem.c b/drivers/gpu/drm/tegra/gem.c
> index 4a4f967c6397..da32086cbeaf 100644
> --- a/drivers/gpu/drm/tegra/gem.c
> +++ b/drivers/gpu/drm/tegra/gem.c
> @@ -210,7 +210,7 @@ static void tegra_bo_free(struct drm_device *drm, struct tegra_bo *bo)
>                 drm_gem_put_pages(&bo->gem, bo->pages, true, true);
>                 sg_free_table(bo->sgt);
>                 kfree(bo->sgt);
> -       } else {
> +       } else if (bo->vaddr) {
>                 dma_free_writecombine(drm->dev, bo->gem.size, bo->vaddr,
>                                       bo->paddr);
>         }
> --
> 2.1.3
>
> _______________________________________________
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel


More information about the dri-devel mailing list