diff options
author | Eric Biggers <ebiggers@google.com> | 2016-09-15 13:13:13 -0400 |
---|---|---|
committer | Theodore Ts'o <tytso@mit.edu> | 2016-09-15 13:13:13 -0400 |
commit | dcce7a46c6f28f41447272fb44348ead8f584573 (patch) | |
tree | a0fca1ac41b755d420516d759f88cb11a7cfdfdf | |
parent | f0c9fd5458bacf7b12a9a579a727dc740cbe047e (diff) |
ext4: fix memory leak when symlink decryption fails
This bug was introduced in v4.8-rc1.
Signed-off-by: Eric Biggers <ebiggers@google.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Cc: stable@vger.kernel.org
-rw-r--r-- | fs/ext4/symlink.c | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/ext4/symlink.c b/fs/ext4/symlink.c index 4d83d9e05f2e..04a7850a0d45 100644 --- a/fs/ext4/symlink.c +++ b/fs/ext4/symlink.c | |||
@@ -65,13 +65,12 @@ static const char *ext4_encrypted_get_link(struct dentry *dentry, | |||
65 | res = fscrypt_fname_alloc_buffer(inode, cstr.len, &pstr); | 65 | res = fscrypt_fname_alloc_buffer(inode, cstr.len, &pstr); |
66 | if (res) | 66 | if (res) |
67 | goto errout; | 67 | goto errout; |
68 | paddr = pstr.name; | ||
68 | 69 | ||
69 | res = fscrypt_fname_disk_to_usr(inode, 0, 0, &cstr, &pstr); | 70 | res = fscrypt_fname_disk_to_usr(inode, 0, 0, &cstr, &pstr); |
70 | if (res < 0) | 71 | if (res < 0) |
71 | goto errout; | 72 | goto errout; |
72 | 73 | ||
73 | paddr = pstr.name; | ||
74 | |||
75 | /* Null-terminate the name */ | 74 | /* Null-terminate the name */ |
76 | if (res <= pstr.len) | 75 | if (res <= pstr.len) |
77 | paddr[res] = '\0'; | 76 | paddr[res] = '\0'; |