diff mbox

ext4: fix memory leak when symlink decryption fails

Message ID 1473707806-37537-1-git-send-email-ebiggers@google.com
State Awaiting Upstream, archived
Headers show

Commit Message

Eric Biggers Sept. 12, 2016, 7:16 p.m. UTC
This bug was introduced in v4.8-rc1.

Signed-off-by: Eric Biggers <ebiggers@google.com>
---
 fs/ext4/symlink.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Theodore Ts'o Sept. 15, 2016, 5:16 p.m. UTC | #1
On Mon, Sep 12, 2016 at 12:16:46PM -0700, Eric Biggers wrote:
> This bug was introduced in v4.8-rc1.
> 
> Signed-off-by: Eric Biggers <ebiggers@google.com>

Thanks, applied.

						- Ted
--
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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';