diff options
author | Eric Biggers <ebiggers@google.com> | 2016-09-15 13:13:13 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-10-22 12:40:25 +0200 |
commit | 5373f6cc610ba2698ff17122aa81e87013044d8c (patch) | |
tree | 7abb044acd70a908d12c263fdc77f3680794c286 /fs/ext4 | |
parent | 7a6893875e246fc7d5900e71e45b90b6dc29fcce (diff) | |
download | lwn-5373f6cc610ba2698ff17122aa81e87013044d8c.tar.gz lwn-5373f6cc610ba2698ff17122aa81e87013044d8c.zip |
ext4: fix memory leak when symlink decryption fails
commit dcce7a46c6f28f41447272fb44348ead8f584573 upstream.
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>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/ext4')
-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, res = fscrypt_fname_alloc_buffer(inode, cstr.len, &pstr); if (res) goto errout; + paddr = pstr.name; res = fscrypt_fname_disk_to_usr(inode, 0, 0, &cstr, &pstr); if (res < 0) goto errout; - paddr = pstr.name; - /* Null-terminate the name */ if (res <= pstr.len) paddr[res] = '\0'; |