diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-26 20:13:05 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-03-26 20:13:05 +0300 |
commit | 02fc59a0d28fcc839266d56fbfc4ca34d8dbb2ae (patch) | |
tree | 46b3f557af716ff70113af73c8b826b0ee8fb10e /fs/crypto/crypto.c | |
parent | 606c61a0579669c292dc5f5e1cf898edecfc0d53 (diff) | |
download | linux-02fc59a0d28fcc839266d56fbfc4ca34d8dbb2ae.tar.xz |
f2fs/crypto: fix xts_tweak initialization
Commit 0b81d07790726 ("fs crypto: move per-file encryption from f2fs
tree to fs/crypto") moved the f2fs crypto files to fs/crypto/ and
renamed the symbol prefixes from "f2fs_" to "fscrypt_" (and from "F2FS_"
to just "FS" for preprocessor symbols).
Because of the symbol renaming, it's a bit hard to see it as a file
move: use
git show -M30 0b81d07790726
to lower the rename detection to just 30% similarity and make git show
the files as renamed (the header file won't be shown as a rename even
then - since all it contains is symbol definitions, it looks almost
completely different).
Even with the renames showing as renames, the diffs are not all that
easy to read, since so much is just the renames. But Eric Biggers
noticed that it's not just all renames: the initialization of the
xts_tweak had been broken too, using the inode number rather than the
page offset.
That's not right - it makes the xfs_tweak the same for all pages of each
inode. It _might_ make sense to make the xfs_tweak contain both the
offset _and_ the inode number, but not just the inode number.
Reported-by: Eric Biggers <ebiggers3@gmail.com>
Cc: Jaegeuk Kim <jaegeuk@kernel.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/crypto/crypto.c')
-rw-r--r-- | fs/crypto/crypto.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/fs/crypto/crypto.c b/fs/crypto/crypto.c index aed9cccca505..06cd1a22240b 100644 --- a/fs/crypto/crypto.c +++ b/fs/crypto/crypto.c @@ -170,7 +170,7 @@ static int do_page_crypto(struct inode *inode, fscrypt_complete, &ecr); BUILD_BUG_ON(FS_XTS_TWEAK_SIZE < sizeof(index)); - memcpy(xts_tweak, &inode->i_ino, sizeof(index)); + memcpy(xts_tweak, &index, sizeof(index)); memset(&xts_tweak[sizeof(index)], 0, FS_XTS_TWEAK_SIZE - sizeof(index)); |