FAILED: patch "[PATCH] ext4: fix memory leaks in" failed to apply to 5.15-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 5.15-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-5.15.y
git checkout FETCH_HEAD
git cherry-pick -x 7ca4b085f430f3774c3838b3da569ceccd6a0177
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2023091607-removal-popular-03e9@gregkh' --subject-prefix 'PATCH 5.15.y' HEAD^..
Possible dependencies:
7ca4b085f430 ("ext4: fix memory leaks in ext4_fname_{setup_filename,prepare_lookup}") 3030b59c8533 ("ext4: cleanup function defs from ext4.h into crypto.c")b1241c8eb977 ("ext4: move ext4 crypto code to its own file crypto.c")5298d4bfe80f ("unicode: clean up the Kconfig symbol confusion")6661224e66f0 ("Merge tag 'unicode-for-next-5.17' of git://git.kernel.org/pub/scm/linux/kernel/git/krisman/unicode")
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From 7ca4b085f430f3774c3838b3da569ceccd6a0177 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lu=C3=ADs=20Henriques?= <[email protected]>
Date: Thu, 3 Aug 2023 10:17:13 +0100
Subject: [PATCH] ext4: fix memory leaks in
ext4_fname_{setup_filename,prepare_lookup}
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
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.
fs/ext4/crypto.c +4 -0
@@ -33,6 +33,8 @@ int ext4_fname_setup_filename(struct inode *dir, const struct qstr *iname,#if IS_ENABLED (CONFIG_UNICODE ) err =ext4_fname_setup_ci_filename (dir, iname, fname); +if (err) +ext4_fname_free_filename (fname);#endif return err; }
@@ -51,6 +53,8 @@ int ext4_fname_prepare_lookup(struct inode *dir, struct dentry *dentry,#if IS_ENABLED (CONFIG_UNICODE ) err =ext4_fname_setup_ci_filename (dir, &dentry->d_name, fname); +if (err) +ext4_fname_free_filename (fname);#endif return err; }