add patch fix-an-endianness-bug-in-ext4_encrypted_follow_link
[ext4-patch-queue.git] / fix-an-endianness-bug-in-ext4_encrypted_follow_link
bloba95978bca469dd2762b20ee30751132170c4fdad
1 ext4: fix an endianness bug in ext4_encrypted_follow_link()
3 From: Al Viro <viro@ZenIV.linux.org.uk>
5 applying le32_to_cpu() to 16bit value is a bad idea...
6     
7 Cc: stable@vger.kernel.org # v4.1+
8 Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
9 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
10 ---
12 diff --git a/fs/ext4/symlink.c b/fs/ext4/symlink.c
13 index abe2401..e8e7af6 100644
14 --- a/fs/ext4/symlink.c
15 +++ b/fs/ext4/symlink.c
16 @@ -52,7 +52,7 @@ static const char *ext4_encrypted_follow_link(struct dentry *dentry, void **cook
17         /* Symlink is encrypted */
18         sd = (struct ext4_encrypted_symlink_data *)caddr;
19         cstr.name = sd->encrypted_path;
20 -       cstr.len  = le32_to_cpu(sd->len);
21 +       cstr.len  = le16_to_cpu(sd->len);
22         if ((cstr.len +
23              sizeof(struct ext4_encrypted_symlink_data) - 1) >
24             max_size) {