linux-fscrypt.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers@kernel.org>
To: linux-f2fs-devel@lists.sourceforge.net
Cc: linux-fscrypt@vger.kernel.org,
	Daniel Rosenberg <drosen@google.com>,
	Gabriel Krisman Bertazi <krisman@collabora.com>,
	stable@vger.kernel.org
Subject: [PATCH 1/4] f2fs: don't leak filename in f2fs_try_convert_inline_dir()
Date: Thu,  7 May 2020 00:59:02 -0700	[thread overview]
Message-ID: <20200507075905.953777-2-ebiggers@kernel.org> (raw)
In-Reply-To: <20200507075905.953777-1-ebiggers@kernel.org>

From: Eric Biggers <ebiggers@google.com>

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>
---
 fs/f2fs/inline.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/fs/f2fs/inline.c b/fs/f2fs/inline.c
index 4167e540815185..59a4b7ff11e17a 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;
-- 
2.26.2


  reply	other threads:[~2020-05-07  8:02 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-05-07  7:59 [PATCH 0/4] f2fs: rework filename handling Eric Biggers
2020-05-07  7:59 ` Eric Biggers [this message]
2020-05-08  8:25   ` [PATCH 1/4] f2fs: don't leak filename in f2fs_try_convert_inline_dir() Chao Yu
2020-05-07  7:59 ` [PATCH 2/4] f2fs: split f2fs_d_compare() from f2fs_match_name() Eric Biggers
2020-05-11  2:47   ` Chao Yu
2020-05-07  7:59 ` [PATCH 3/4] f2fs: rework filename handling Eric Biggers
2020-05-25  8:12   ` Chao Yu
2020-05-25 15:10     ` [f2fs-dev] " Jaegeuk Kim
2020-05-07  7:59 ` [RFC PATCH 4/4] f2fs: Handle casefolding with Encryption (INCOMPLETE) Eric Biggers
2020-05-08  2:55   ` Eric Biggers
2020-05-07 13:09 ` [f2fs-dev] [PATCH 0/4] f2fs: rework filename handling Jaegeuk Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200507075905.953777-2-ebiggers@kernel.org \
    --to=ebiggers@kernel.org \
    --cc=drosen@google.com \
    --cc=krisman@collabora.com \
    --cc=linux-f2fs-devel@lists.sourceforge.net \
    --cc=linux-fscrypt@vger.kernel.org \
    --cc=stable@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).