From: Eric Biggers Date: Thu, 15 Sep 2016 17:13:13 +0000 (-0400) Subject: ext4: fix memory leak when symlink decryption fails X-Git-Tag: v4.14-rc1~2333^2~19 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=dcce7a46c6f28f41447272fb44348ead8f584573;p=platform%2Fkernel%2Flinux-rpi.git ext4: fix memory leak when symlink decryption fails This bug was introduced in v4.8-rc1. Signed-off-by: Eric Biggers Signed-off-by: Theodore Ts'o Cc: stable@vger.kernel.org --- diff --git a/fs/ext4/symlink.c b/fs/ext4/symlink.c index 4d83d9e..04a7850 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';