add patch create-function-to-read-journal-inode
[ext4-patch-queue.git] / fix-memory-leak-when-symlink-decryption-fails
blob2dc3ee1a22e5a2c53260235dccb6ec28fde68300
1 ext4: fix memory leak when symlink decryption fails
3 From: Eric Biggers <ebiggers@google.com>
5 This bug was introduced in v4.8-rc1.
7 Signed-off-by: Eric Biggers <ebiggers@google.com>
8 Signed-off-by: Theodore Ts'o <tytso@mit.edu>
9 Cc: stable@vger.kernel.org
10 ---
11  fs/ext4/symlink.c | 3 +--
12  1 file changed, 1 insertion(+), 2 deletions(-)
14 diff --git a/fs/ext4/symlink.c b/fs/ext4/symlink.c
15 index 4d83d9e..04a7850 100644
16 --- a/fs/ext4/symlink.c
17 +++ b/fs/ext4/symlink.c
18 @@ -65,13 +65,12 @@ static const char *ext4_encrypted_get_link(struct dentry *dentry,
19         res = fscrypt_fname_alloc_buffer(inode, cstr.len, &pstr);
20         if (res)
21                 goto errout;
22 +       paddr = pstr.name;
24         res = fscrypt_fname_disk_to_usr(inode, 0, 0, &cstr, &pstr);
25         if (res < 0)
26                 goto errout;
28 -       paddr = pstr.name;
30         /* Null-terminate the name */
31         if (res <= pstr.len)
32                 paddr[res] = '\0';
33 -- 
34 2.8.0.rc3.226.g39d4020