CVE-2023-53662: ext4: fix memory leaks in ext4_fname_{setup_filename,prepare_lookup}
From: Greg Kroah-Hartman <[email protected]>
Description
===========
In the Linux kernel, the following vulnerability has been resolved:
ext4: fix memory leaks in ext4_fname_{setup_filename,prepare_lookup}
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.
The Linux kernel CVE team has assigned CVE-2023-53662 to this issue.
Affected and fixed versions
===========================
Issue introduced in 5.13 with commit 1ae98e295fa2577fb5e492200c58d10230e00e99 and fixed in 6.1.54 with commit 1fb3f1bbfdb511034b0360dbeb0f6a8424ed2a5c Issue introduced in 5.13 with commit 1ae98e295fa2577fb5e492200c58d10230e00e99 and fixed in 6.5.4 with commit 36daf050be3f6f067631dc52054de2d3b7cc849f Issue introduced in 5.13 with commit 1ae98e295fa2577fb5e492200c58d10230e00e99 and fixed in 6.6 with commit 7ca4b085f430f3774c3838b3da569ceccd6a0177
Please see https://www.kernel.org for a full list of currently supported kernel versions by the kernel community.
Unaffected versions might change over time as fixes are backported to older supported kernel versions. The official CVE entry at
https://cve.org/CVERecord/?id=CVE-2023-53662
will be updated if fixes are backported, please check that for the most up to date information about this issue.
Affected files
==============
The file(s) affected by this issue are:
fs/ext4/crypto.c
Mitigation
==========
The Linux kernel CVE team recommends that you update to the latest stable kernel version for this, and many other bugfixes. Individual changes are never tested alone, but rather are part of a larger kernel release. Cherry-picking individual commits is not recommended or supported by the Linux kernel community at all. If however, updating to the latest release is impossible, the individual changes to resolve this issue can be found at these commits:
https://git.kernel.org/stable/c/1fb3f1bbfdb511034b0360dbeb0f6a8424ed2a5c https://git.kernel.org/stable/c/36daf050be3f6f067631dc52054de2d3b7cc849f https://git.kernel.org/stable/c/7ca4b085f430f3774c3838b3da569ceccd6a0177