mm: introduce vma_set_file function v5
[linux-block.git] / drivers / gpu / drm / i915 / gem / i915_gem_mman.c
index 3d69e51f3e4df0a3002a14d5ebf1995b35fed9a0..ec28a6cde49bddf206ade1c71e20249257f729cd 100644 (file)
@@ -893,8 +893,9 @@ int i915_gem_mmap(struct file *filp, struct vm_area_struct *vma)
         * requires avoiding extraneous references to their filp, hence why
         * we prefer to use an anonymous file for their mmaps.
         */
-       fput(vma->vm_file);
-       vma->vm_file = anon;
+       vma_set_file(vma, anon);
+       /* Drop the initial creation reference, the vma is now holding one. */
+       fput(anon);
 
        switch (mmo->mmap_type) {
        case I915_MMAP_TYPE_WC: