Commit b9b4bb26 authored by Anthony Romano's avatar Anthony Romano Committed by Linus Torvalds

tmpfs: don't undo fallocate past its last page

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

Fixes: 1635f6a7 ("tmpfs: undo fallocation on failure")
Link: default avatarAnthony Romano <>
Cc: Vlastimil Babka <>
Cc: Hugh Dickins <>
Cc: Brandon Philips <>
Cc: <>
Signed-off-by: default avatarAndrew Morton <>
Signed-off-by: default avatarLinus Torvalds <>
parent a7b50abc
......@@ -2227,7 +2227,7 @@ static long shmem_fallocate(struct file *file, int mode, loff_t offset,
/* Remove the !PageUptodate pages we added */
(loff_t)start << PAGE_SHIFT,
(loff_t)index << PAGE_SHIFT, true);
((loff_t)index << PAGE_SHIFT) - 1, true);
goto undone;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment