]> git.baikalelectronics.ru Git - kernel.git/commit
ext4: fix memory leaks in ext4_fname_{setup_filename,prepare_lookup}
authorLuís Henriques <lhenriques@suse.de>
Thu, 3 Aug 2023 09:17:13 +0000 (10:17 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 19 Sep 2023 10:28:05 +0000 (12:28 +0200)
commit1fb3f1bbfdb511034b0360dbeb0f6a8424ed2a5c
tree574a1aa9863dae7aa6e67730b5e02eb45b5beeb5
parent03393857a95b59d5dfa9fd06e597d289d7e060d1
ext4: fix memory leaks in ext4_fname_{setup_filename,prepare_lookup}

commit 7ca4b085f430f3774c3838b3da569ceccd6a0177 upstream.

If the filename casefolding fails, we'll be leaking memory from the
fscrypt_name struct, namely from the 'crypto_buf.name' member.

Make sure we free it in the error path on both ext4_fname_setup_filename()
and ext4_fname_prepare_lookup() functions.

Cc: stable@kernel.org
Fixes: 1ae98e295fa2 ("ext4: optimize match for casefolded encrypted dirs")
Signed-off-by: Luís Henriques <lhenriques@suse.de>
Reviewed-by: Eric Biggers <ebiggers@google.com>
Link: https://lore.kernel.org/r/20230803091713.13239-1-lhenriques@suse.de
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/ext4/crypto.c