blob: 6b4010bb59bcd3699a733500eeb7e70cebf4fa66 [file] [log] [blame]
--- a/drivers/gpu/drm/i915/i915_gem.c
+++ b/drivers/gpu/drm/i915/i915_gem.c
@@ -1290,10 +1290,17 @@ i915_gem_mmap_ioctl(struct drm_device *d
drm_gem_object_unreference_unlocked(obj);
return -EINVAL;
}
-
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,4,0))
+ down_write(&current->mm->mmap_sem);
+ addr = do_mmap(obj->filp, 0, args->size,
+ PROT_READ | PROT_WRITE, MAP_SHARED,
+ args->offset);
+ up_write(&current->mm->mmap_sem);
+#else
addr = vm_mmap(obj->filp, 0, args->size,
PROT_READ | PROT_WRITE, MAP_SHARED,
args->offset);
+#endif
drm_gem_object_unreference_unlocked(obj);
if (IS_ERR((void *)addr))
return addr;