]> git.hungrycats.org Git - linux/commit
eCryptfs: make ecryptfs_prepare_write decrypt the page
authorMichael Halcrow <mhalcrow@us.ibm.com>
Wed, 5 Mar 2008 00:50:13 +0000 (00:50 +0000)
committerChris Wright <chrisw@sous-sol.org>
Mon, 24 Mar 2008 18:47:34 +0000 (11:47 -0700)
commitd458a7c853ced17ff79a2a213f0c4e59e5715c1b
treea8c97b0340bde5919d0965cb78242dee2be03260
parentf2336eeb199d3ed113e6d01c8020ea8919dd85c9
eCryptfs: make ecryptfs_prepare_write decrypt the page

commit: e4465fdaeb3f7b5ef47f389d3eac76db79ff20d8

When the page is not up to date, ecryptfs_prepare_write() should be
acting much like ecryptfs_readpage(). This includes the painfully
obvious step of actually decrypting the page contents read from the
lower encrypted file.

Note that this patch resolves a bug in eCryptfs in 2.6.24 that one can
produce with these steps:

# mount -t ecryptfs /secret /secret
# echo "abc" > /secret/file.txt
# umount /secret
# mount -t ecryptfs /secret /secret
# echo "def" >> /secret/file.txt
# cat /secret/file.txt

Without this patch, the resulting data returned from cat is likely to
be something other than "abc\ndef\n".

(Thanks to Benedikt Driessen for reporting this.)

Signed-off-by: Michael Halcrow <mhalcrow@us.ibm.com>
Cc: Benedikt Driessen <bdriessen@escrypt.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
[chrisw@sous-sol.org: backport to 2.6.24.3]
Signed-off-by: Chris Wright <chrisw@sous-sol.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/ecryptfs/mmap.c