Skip to content

Commit 1d3255b

Browse files
Anthony Romanogregkh
authored andcommitted
tmpfs: don't undo fallocate past its last page
commit b9b4bb26af017dbe930cd4df7f9b2fc3a0497bfe upstream. When fallocate is interrupted it will undo a range that extends one byte past its range of allocated pages. This can corrupt an in-use page by zeroing out its first byte. Instead, undo using the inclusive byte range. Fixes: 1635f6a ("tmpfs: undo fallocation on failure") Link: http://lkml.kernel.org/r/1462713387-16724-1-git-send-email-anthony.romano@coreos.com Signed-off-by: Anthony Romano <anthony.romano@coreos.com> Cc: Vlastimil Babka <vbabka@suse.cz> Cc: Hugh Dickins <hughd@google.com> Cc: Brandon Philips <brandon@ifup.co> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent d6317d7 commit 1d3255b

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

mm/shmem.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2155,7 +2155,7 @@ static long shmem_fallocate(struct file *file, int mode, loff_t offset,
21552155
/* Remove the !PageUptodate pages we added */
21562156
shmem_undo_range(inode,
21572157
(loff_t)start << PAGE_CACHE_SHIFT,
2158-
(loff_t)index << PAGE_CACHE_SHIFT, true);
2158+
((loff_t)index << PAGE_CACHE_SHIFT) - 1, true);
21592159
goto undone;
21602160
}
21612161

0 commit comments

Comments
 (0)