Merge tag 'v3.10.103' into update
[GitHub/mt8127/android_kernel_alcatel_ttab.git] / mm / shmem.c
index e490ad476f01381e6b210a9130f96a62ec7409bd..d95e308fc4aae57d04959613c8ed479fc73d351e 100644 (file)
@@ -1958,9 +1958,11 @@ static long shmem_fallocate(struct file *file, int mode, loff_t offset,
                                                                        NULL);
                if (error) {
                        /* Remove the !PageUptodate pages we added */
-                       shmem_undo_range(inode,
-                               (loff_t)start << PAGE_CACHE_SHIFT,
-                               (loff_t)index << PAGE_CACHE_SHIFT, true);
+                       if (index > start) {
+                               shmem_undo_range(inode,
+                                (loff_t)start << PAGE_CACHE_SHIFT,
+                                ((loff_t)index << PAGE_CACHE_SHIFT) - 1, true);
+                       }
                        goto undone;
                }