video: tegra: nvmap: fix incorrect memory access
Krishna Reddy [Fri, 30 Aug 2013 15:27:29 +0000 (08:27 -0700)]
fix incorrect memory access sequence in nvmap_dmabuf_release().
handle memory access after handle put can result in accessing
freed memory.

Change-Id: I824b348366c1737c9d5ec15cc58613938203fb0f
Signed-off-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-on: http://git-master/r/268584
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Alex Waterman <alexw@nvidia.com>
GVS: Gerrit_Virtual_Submit

drivers/video/tegra/nvmap/nvmap_dmabuf.c

index 482145a..b47be8d 100644 (file)
@@ -92,8 +92,8 @@ static void nvmap_dmabuf_release(struct dma_buf *dmabuf)
 
        pr_debug("%s() 0x%p\n", __func__, info->handle);
 
-       nvmap_handle_put(info->handle);
        info->handle->dmabuf = NULL;
+       nvmap_handle_put(info->handle);
        kfree(info);
 }