diff options
author | Krishna Reddy <vdumpa@nvidia.com> | 2014-04-16 16:22:33 -0700 |
---|---|---|
committer | Seema Khowala <seemaj@nvidia.com> | 2014-04-23 14:05:54 -0700 |
commit | cea4309c457f298e297ca67b0419f7c7020b8630 (patch) | |
tree | 5797710d49c04ae7753d3488545eac2de5b66f03 /drivers/video | |
parent | 4e4227ecd06fd6f1bd5d9efe08a146efa0b7741d (diff) |
video: tegra: nvmap: vma need to be tracked during mmap
Add missing vma tracking during mmap.
Bug 1444151
Change-Id: Id0485237c96e97a3e1da55f14e5533a48fd2bde7
Signed-off-by: Krishna Reddy <vdumpa@nvidia.com>
Reviewed-on: http://git-master/r/397390
Diffstat (limited to 'drivers/video')
-rw-r--r-- | drivers/video/tegra/nvmap/nvmap_dev.c | 12 | ||||
-rw-r--r-- | drivers/video/tegra/nvmap/nvmap_ioctl.c | 1 | ||||
-rw-r--r-- | drivers/video/tegra/nvmap/nvmap_priv.h | 1 |
3 files changed, 4 insertions, 10 deletions
diff --git a/drivers/video/tegra/nvmap/nvmap_dev.c b/drivers/video/tegra/nvmap/nvmap_dev.c index 076c7fa14c07..7cb0a9ec7522 100644 --- a/drivers/video/tegra/nvmap/nvmap_dev.c +++ b/drivers/video/tegra/nvmap/nvmap_dev.c @@ -85,7 +85,6 @@ static int nvmap_open(struct inode *inode, struct file *filp); static int nvmap_release(struct inode *inode, struct file *filp); static long nvmap_ioctl(struct file *filp, unsigned int cmd, unsigned long arg); static int nvmap_map(struct file *filp, struct vm_area_struct *vma); -static void nvmap_vma_open(struct vm_area_struct *vma); static void nvmap_vma_close(struct vm_area_struct *vma); static int nvmap_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf); @@ -524,10 +523,7 @@ int __nvmap_map(struct nvmap_handle *h, struct vm_area_struct *vma) priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; - - priv->offs = 0; priv->handle = h; - atomic_set(&priv->count, 1); vma->vm_flags |= VM_SHARED | VM_DONTEXPAND | VM_DONTDUMP | VM_DONTCOPY | @@ -536,6 +532,7 @@ int __nvmap_map(struct nvmap_handle *h, struct vm_area_struct *vma) BUG_ON(vma->vm_private_data != NULL); vma->vm_private_data = priv; vma->vm_page_prot = nvmap_pgprot(h, vma->vm_page_prot); + nvmap_vma_open(vma); return 0; } @@ -552,15 +549,10 @@ static int nvmap_map(struct file *filp, struct vm_area_struct *vma) if (!priv) return -ENOMEM; - priv->offs = 0; - priv->handle = NULL; - atomic_set(&priv->count, 1); - vma->vm_flags |= (VM_SHARED | VM_DONTEXPAND | VM_DONTDUMP | VM_DONTCOPY); vma->vm_ops = &nvmap_vma_ops; vma->vm_private_data = priv; - return 0; } @@ -687,7 +679,7 @@ static long nvmap_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) * the handle, and nvmap_vma_close decrements it. alternatively, we could * disallow copying of the vma, or behave like pmem and zap the pages. FIXME. */ -static void nvmap_vma_open(struct vm_area_struct *vma) +void nvmap_vma_open(struct vm_area_struct *vma) { struct nvmap_vma_priv *priv; struct nvmap_handle *h; diff --git a/drivers/video/tegra/nvmap/nvmap_ioctl.c b/drivers/video/tegra/nvmap/nvmap_ioctl.c index f5d9ac3af2f9..9ebdb1d00cbf 100644 --- a/drivers/video/tegra/nvmap/nvmap_ioctl.c +++ b/drivers/video/tegra/nvmap/nvmap_ioctl.c @@ -509,6 +509,7 @@ int nvmap_map_into_caller_ptr(struct file *filp, void __user *arg, bool is32) vpriv->handle = h; vpriv->offs = op.offset; vma->vm_page_prot = nvmap_pgprot(h, vma->vm_page_prot); + nvmap_vma_open(vma); out: up_read(¤t->mm->mmap_sem); diff --git a/drivers/video/tegra/nvmap/nvmap_priv.h b/drivers/video/tegra/nvmap/nvmap_priv.h index 242f8473d66e..b04a82829582 100644 --- a/drivers/video/tegra/nvmap/nvmap_priv.h +++ b/drivers/video/tegra/nvmap/nvmap_priv.h @@ -501,4 +501,5 @@ static inline struct page **nvmap_pages(struct page **pg_pages, u32 nr_pages) return pages; } +void nvmap_vma_open(struct vm_area_struct *vma); #endif /* __VIDEO_TEGRA_NVMAP_NVMAP_H */ |