]> git.itanic.dy.fi Git - linux-stable/commit
tmpfs: don't undo fallocate past its last page
authorAnthony Romano <anthony.romano@coreos.com>
Fri, 24 Jun 2016 21:48:43 +0000 (14:48 -0700)
committerBen Hutchings <ben@decadent.org.uk>
Mon, 22 Aug 2016 21:38:20 +0000 (22:38 +0100)
commitc248b3ba3ad07a74e77f493c2b8c4963fa59ce93
tree3c6ee508ae98c399335bcf709ff1d8090f518b0d
parent2e4378ee60049b752c9dce16f62ce6fbd11b379a
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: 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>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[bwh: Backported to 3.16: use PAGE_CACHE_SHIFT instead of PAGE_SHIFT]
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
mm/shmem.c