From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7AFC9C433E0 for ; Fri, 19 Jun 2020 15:33:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4C62F20786 for ; Fri, 19 Jun 2020 15:33:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592580832; bh=ctnKrlZlC9i41gZd4wzwt14jBTE8bLOOurempFZmoAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=LPAwKP1IiLaSiLRy2ufuYWA9DhH2cdIlqM0/r9Ip61Yg8u+Gps1Lc4P6nYPCo59zG w4jUXQ5LfhW3FZrL/4Geal1HMGneTOZ218HDkxJTawukLFV+cIY58EFQJddwnyGUi9 ivRygbRwz7O5lkSzRZE6m7CrdrT/QH36+5Z2P0VE= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404931AbgFSPdG (ORCPT ); Fri, 19 Jun 2020 11:33:06 -0400 Received: from mail.kernel.org ([198.145.29.99]:36586 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2393897AbgFSPce (ORCPT ); Fri, 19 Jun 2020 11:32:34 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 0D26020757; Fri, 19 Jun 2020 15:32:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592580754; bh=ctnKrlZlC9i41gZd4wzwt14jBTE8bLOOurempFZmoAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Cmhx8AY62PN4C0wpW8E/iYDpZcxkORVSvPptDbA7nPhzOMFAXSAI3GYMImUsM76sI 8mtzom4s4Dp1sq3EYPiNsL12I+BXmAVNTcHjli5YRB/EpEOf8HLK9Dq7EPXrJ1Z0cm FKdR7xtTlrKaLhchlGnqJoqwknb3K2+PsgfcVgcc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Eric Biggers , Chao Yu , Jaegeuk Kim Subject: [PATCH 5.7 370/376] f2fs: dont leak filename in f2fs_try_convert_inline_dir() Date: Fri, 19 Jun 2020 16:34:48 +0200 Message-Id: <20200619141727.806071516@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141710.350494719@linuxfoundation.org> References: <20200619141710.350494719@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Eric Biggers commit ff5f85c8d62a487bde415ef4c9e2d0be718021df upstream. 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: # v5.6+ Signed-off-by: Eric Biggers Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim Signed-off-by: Greg Kroah-Hartman --- fs/f2fs/inline.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) --- a/fs/f2fs/inline.c +++ b/fs/f2fs/inline.c @@ -559,12 +559,12 @@ int f2fs_try_convert_inline_dir(struct i 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 i 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;