add patch fix-an-endianness-bug-in-ext4_encrypted_follow_link
[ext4-patch-queue.git] / fix-an-endianness-bug-in-ext4_encrypted-zeroout
blob5ec56d3157a29104842880f1269fb56721667924
1 ext4: fix an endianness bug in ext4_encrypted_zeroout()
3 From: Al Viro <viro@ZenIV.linux.org.uk>
5 ex->ee_block is not host-endian (note that accesses of other fields
6 of *ex right next to that line go through the helpers that do proper
7 conversion from little-endian to host-endian; it might make sense
8 to add similar for ->ee_block to avoid reintroducing that kind of
9 bugs...)
11 Cc: stable@vger.kernel.org # v4.1+
12 Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
13 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
14 ---
16 diff --git a/fs/ext4/crypto.c b/fs/ext4/crypto.c
17 index af06830..1a08350 100644
18 --- a/fs/ext4/crypto.c
19 +++ b/fs/ext4/crypto.c
20 @@ -389,7 +389,7 @@ int ext4_encrypted_zeroout(struct inode *inode, struct ext4_extent *ex)
21         struct ext4_crypto_ctx  *ctx;
22         struct page             *ciphertext_page = NULL;
23         struct bio              *bio;
24 -       ext4_lblk_t             lblk = ex->ee_block;
25 +       ext4_lblk_t             lblk = le32_to_cpu(ex->ee_block);
26         ext4_fsblk_t            pblk = ext4_ext_pblock(ex);
27         unsigned int            len = ext4_ext_get_actual_len(ex);
28         int                     ret, err = 0;
30 To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
31 the body of a message to majordomo@vger.kernel.org
32 More majordomo info at  http://vger.kernel.org/majordomo-info.html
33 Please read the FAQ at  http://www.tux.org/lkml/