Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit dcce7a46 authored by Eric Biggers's avatar Eric Biggers Committed by Theodore Ts'o
Browse files

ext4: fix memory leak when symlink decryption fails



This bug was introduced in v4.8-rc1.

Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
Cc: stable@vger.kernel.org
parent f0c9fd54
Loading
Loading
Loading
Loading
+1 −2
Original line number Diff line number Diff line
@@ -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';