Upgrade to 4.4.50-rt62
[kvmfornfv.git] / kernel / mm / shmem.c
index ea5a70c..1b11ccc 100644 (file)
@@ -2153,9 +2153,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;
                }