Commit ff5f85c8 authored by Eric Biggers's avatar Eric Biggers Committed by Jaegeuk Kim

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: b06af2af ("f2fs: convert inline_dir early before starting rename")
Cc: <stable@vger.kernel.org> # v5.6+
Signed-off-by: default avatarEric Biggers <ebiggers@google.com>
Reviewed-by: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent 6d92b201
...@@ -559,12 +559,12 @@ int f2fs_try_convert_inline_dir(struct inode *dir, struct dentry *dentry) ...@@ -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); ipage = f2fs_get_node_page(sbi, dir->i_ino);
if (IS_ERR(ipage)) { if (IS_ERR(ipage)) {
err = PTR_ERR(ipage); err = PTR_ERR(ipage);
goto out; goto out_fname;
} }
if (f2fs_has_enough_room(dir, ipage, &fname)) { if (f2fs_has_enough_room(dir, ipage, &fname)) {
f2fs_put_page(ipage, 1); f2fs_put_page(ipage, 1);
goto out; goto out_fname;
} }
inline_dentry = inline_data_addr(dir, ipage); inline_dentry = inline_data_addr(dir, ipage);
...@@ -572,6 +572,8 @@ int f2fs_try_convert_inline_dir(struct inode *dir, struct dentry *dentry) ...@@ -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); err = do_convert_inline_dir(dir, ipage, inline_dentry);
if (!err) if (!err)
f2fs_put_page(ipage, 1); f2fs_put_page(ipage, 1);
out_fname:
fscrypt_free_filename(&fname);
out: out:
f2fs_unlock_op(sbi); f2fs_unlock_op(sbi);
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment