diff options
author | Thierry Reding <treding@nvidia.com> | 2014-11-06 14:41:31 +0100 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2014-11-13 16:18:34 +0100 |
commit | 7e0180e3570cc791e95e6b6cd5fbeb0aedc62776 (patch) | |
tree | b98d5c0e8033fdc37f98baa07a24e2d28b5eb459 | |
parent | cb10c81fdf8c77df4fffc8cb740ddf33427869df (diff) |
drm/tegra: gem: Check before freeing CMA memorydrm/tegra/for-3.19-rc1
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@chromium.org>
Reviewed-by: Sean Paul <seanpaul@chromium.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r-- | drivers/gpu/drm/tegra/gem.c | 2 |
1 files changed, 1 insertions, 1 deletions
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); } |