summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSri Krishna chowdary <schowdary@nvidia.com>2016-01-12 15:54:08 +0530
committerMatthew Pedro <mapedro@nvidia.com>2016-04-28 14:59:17 -0700
commit084df2dcb7607c947d061056a66eef55f308512c (patch)
tree4ba4ea403df5be4bcf370c1a4ba5b923940012c9
parent69291e6a08ddef8fc504d57f5e995fc336ca14c2 (diff)
[media] v4l: vb2-dma-contig: fix vb2_get_vma()
nvmap expects that same VMA is opened and closed to disallow memory leaks. So, nvmap panics if a previously non-existent vma is being closed through it. Hence modify the sequence in vb2_get_vma() to open the vma_copy before returning it. This way nvmap sees that the vma_copy exists in its list and will close the vma. Bug 200164002 Change-Id: I45dfb8ca710375a0e70d9802ebdcc9fd4d0b4600 Signed-off-by: Sri Krishna chowdary <schowdary@nvidia.com> Reviewed-on: http://git-master/r/931997 (cherry picked from commit bf1d15d8a879a599f9801310cecbbb61ea60e931) Reviewed-on: http://git-master/r/1133707 Tested-by: Bryan Wu <pengw@nvidia.com> Reviewed-by: Bryan Wu <pengw@nvidia.com> Reviewed-by: Krishna Reddy <vdumpa@nvidia.com> Reviewed-by: Matthew Pedro <mapedro@nvidia.com>
-rw-r--r--drivers/media/v4l2-core/videobuf2-memops.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/media/v4l2-core/videobuf2-memops.c b/drivers/media/v4l2-core/videobuf2-memops.c
index 81c1ad8b2cf1..a8099ba5a62c 100644
--- a/drivers/media/v4l2-core/videobuf2-memops.c
+++ b/drivers/media/v4l2-core/videobuf2-memops.c
@@ -49,6 +49,12 @@ struct vm_area_struct *vb2_get_vma(struct vm_area_struct *vma)
memcpy(vma_copy, vma, sizeof(*vma));
+ if (vma_copy->vm_ops && vma_copy->vm_ops->open)
+ vma_copy->vm_ops->open(vma_copy);
+
+ if (vma->vm_ops && vma->vm_ops->close)
+ vma->vm_ops->close(vma);
+
vma_copy->vm_mm = NULL;
vma_copy->vm_next = NULL;
vma_copy->vm_prev = NULL;