summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric Biggers <ebiggers@google.com>2020-05-07 00:59:02 -0700
committerJaegeuk Kim <jaegeuk@kernel.org>2020-05-11 20:36:46 -0700
commitff5f85c8d62a487bde415ef4c9e2d0be718021df (patch)
treee172ecf5277b6f59da59d3de06a87759a6b7ce06
parent6d92b201035dfe77426f8814fd5259db385a18b3 (diff)
downloadlinux-ff5f85c8d62a487bde415ef4c9e2d0be718021df.tar.bz2
f2fs: don't leak filename in f2fs_try_convert_inline_dir()
We need to call fscrypt_free_filename() to free the memory allocated by fscrypt_setup_filename(). Fixes: b06af2aff28b ("f2fs: convert inline_dir early before starting rename") Cc: <stable@vger.kernel.org> # v5.6+ Signed-off-by: Eric Biggers <ebiggers@google.com> Reviewed-by: Chao Yu <yuchao0@huawei.com> Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
-rw-r--r--fs/f2fs/inline.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c
index 4167e5408151..59a4b7ff11e1 100644
--- a/fs/f2fs/inline.c
+++ b/fs/f2fs/inline.c
@@ -559,12 +559,12 @@ int f2fs_try_convert_inline_dir(struct inode *dir, struct dentry *dentry)
ipage = f2fs_get_node_page(sbi, dir->i_ino);
if (IS_ERR(ipage)) {
err = PTR_ERR(ipage);
- goto out;
+ goto out_fname;
}
if (f2fs_has_enough_room(dir, ipage, &fname)) {
f2fs_put_page(ipage, 1);
- goto out;
+ goto out_fname;
}
inline_dentry = inline_data_addr(dir, ipage);
@@ -572,6 +572,8 @@ int f2fs_try_convert_inline_dir(struct inode *dir, struct dentry *dentry)
err = do_convert_inline_dir(dir, ipage, inline_dentry);
if (!err)
f2fs_put_page(ipage, 1);
+out_fname:
+ fscrypt_free_filename(&fname);
out:
f2fs_unlock_op(sbi);
return err;