android_kernel_xiaomi_sm8350/fs/ecryptfs
Eric Sandeen 7fcba05437 eCryptfs: use page_alloc not kmalloc to get a page of memory
With SLUB debugging turned on in 2.6.26, I was getting memory corruption
when testing eCryptfs.  The root cause turned out to be that eCryptfs was
doing kmalloc(PAGE_CACHE_SIZE); virt_to_page() and treating that as a nice
page-aligned chunk of memory.  But at least with SLUB debugging on, this
is not always true, and the page we get from virt_to_page does not
necessarily match the PAGE_CACHE_SIZE worth of memory we got from kmalloc.

My simple testcase was 2 loops doing "rm -f fileX; cp /tmp/fileX ." for 2
different multi-megabyte files.  With this change I no longer see the
corruption.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Acked-by: Michael Halcrow <mhalcrow@us.ibm.com>
Acked-by: Rik van Riel <riel@redhat.com>
Cc: <stable@kernel.org>		[2.6.25.x, 2.6.26.x]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2008-07-28 16:30:21 -07:00
..
crypto.c eCryptfs: use page_alloc not kmalloc to get a page of memory 2008-07-28 16:30:21 -07:00
debug.c eCryptfs: update comment and debug statement 2007-10-16 09:43:11 -07:00
dentry.c eCryptfs: Swap dput() and mntput() 2008-03-19 18:53:36 -07:00
ecryptfs_kernel.h eCryptfs: Make all persistent file opens delayed 2008-07-24 10:47:31 -07:00
file.c eCryptfs: Make all persistent file opens delayed 2008-07-24 10:47:31 -07:00
inode.c [PATCH] kill nameidata passing to permission(), rename to inode_permission() 2008-07-26 20:53:31 -04:00
keystore.c ecryptfs: propagate key errors up at mount time 2008-07-24 10:47:31 -07:00
kthread.c eCryptfs: Privileged kthread for lower file opens 2008-07-24 10:47:30 -07:00
main.c SL*B: drop kmem cache argument from constructor 2008-07-26 12:00:07 -07:00
Makefile eCryptfs: Privileged kthread for lower file opens 2008-07-24 10:47:30 -07:00
messaging.c eCryptfs: make key module subsystem respect namespaces 2008-04-29 08:06:07 -07:00
miscdev.c ecryptfs: discard ecryptfsd registration messages in miscdev 2008-07-24 10:47:31 -07:00
mmap.c ecryptfs: inode.c mmap.c use unaligned byteorder helpers 2008-07-24 10:47:31 -07:00
netlink.c eCryptfs: make key module subsystem respect namespaces 2008-04-29 08:06:07 -07:00
read_write.c eCryptfs: remove unnecessary page decrypt call 2008-06-06 11:29:09 -07:00
super.c ecryptfs: remove debug as mount option, and warn if set via modprobe 2008-02-06 10:41:12 -08:00