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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Nov 6, 2014 at 10:57 AM, Thierry Reding
<thierry.reding@xxxxxxxxx> wrote:
> From: Thierry Reding <treding@xxxxxxxxxx>
>
> 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@xxxxxxxxxx>

nit: I'd prefer to use seanpaul@xxxxxxxxxxxx instead of my google.com address


> Signed-off-by: Thierry Reding <treding@xxxxxxxxxx>

Reviewed-by: Sean Paul <seanpaul@xxxxxxxxxxxx>

> ---
>  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@xxxxxxxxxxxxxxxxxxxxx
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel





[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux