diff options
author | Krishna Reddy <vdumpa@nvidia.com> | 2014-06-17 12:30:16 -0700 |
---|---|---|
committer | Winnie Hsu <whsu@nvidia.com> | 2014-08-08 14:41:49 -0700 |
commit | 8bfcc61d2587b9f13192653ebad24e01d2c95d2c (patch) | |
tree | 151bfe3d175db954e24343fd7d10ccfa686dd69f /drivers | |
parent | 97b7a88bcdd938ff4e3bf156f966b722b2b53eba (diff) |
video: tegra: nvmap: set handle dmabuf to NULL early
This can allow catching handle dmabuf usage during its free.
Bug 1529015
Change-Id: Ie20c7b860ca5194a190ff7005302bf50602d16ed
Signed-off-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-on: http://git-master/r/424329
(cherry picked from commit 10e648c2e2f9760c97ce55a1091d9e7097d2504d)
Reviewed-on: http://git-master/r/448530
Tested-by: Winnie Hsu <whsu@nvidia.com>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/video/tegra/nvmap/nvmap_dmabuf.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/video/tegra/nvmap/nvmap_dmabuf.c b/drivers/video/tegra/nvmap/nvmap_dmabuf.c index 518100b95cce..162e4346454c 100644 --- a/drivers/video/tegra/nvmap/nvmap_dmabuf.c +++ b/drivers/video/tegra/nvmap/nvmap_dmabuf.c @@ -429,6 +429,8 @@ static void nvmap_dmabuf_release(struct dma_buf *dmabuf) info->handle->owner->name : "unknown", info->handle, dmabuf); + BUG_ON(dmabuf != info->handle->dmabuf); + info->handle->dmabuf = NULL; mutex_lock(&info->maps_lock); while (!list_empty(&info->maps)) { @@ -440,8 +442,7 @@ static void nvmap_dmabuf_release(struct dma_buf *dmabuf) } mutex_unlock(&info->maps_lock); - dma_buf_detach(info->handle->dmabuf, info->handle->attachment); - info->handle->dmabuf = NULL; + dma_buf_detach(dmabuf, info->handle->attachment); nvmap_handle_put(info->handle); kfree(info); } |