Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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
range.

Fixes: 1635f6a74152f1d ("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>
Cc: <stable@vger.kernel.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Anthony Romano and committed by
Linus Torvalds
b9b4bb26 a7b50abc

+1 -1
+1 -1
mm/shmem.c
··· 2227 2227 /* Remove the !PageUptodate pages we added */ 2228 2228 shmem_undo_range(inode, 2229 2229 (loff_t)start << PAGE_SHIFT, 2230 - (loff_t)index << PAGE_SHIFT, true); 2230 + ((loff_t)index << PAGE_SHIFT) - 1, true); 2231 2231 goto undone; 2232 2232 } 2233 2233