summaryrefslogtreecommitdiffstats
path: root/kernel/mm/shmem.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/mm/shmem.c')
-rw-r--r--kernel/mm/shmem.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/kernel/mm/shmem.c b/kernel/mm/shmem.c
index ea5a70cfc..1b11ccc0a 100644
--- a/kernel/mm/shmem.c
+++ b/kernel/mm/shmem.c
@@ -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;
}