From patchwork Fri Jun 19 14:34:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 224039 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=ham 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 8ABC7C433DF for ; Fri, 19 Jun 2020 15:32:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 501932193E for ; Fri, 19 Jun 2020 15:32:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592580757; bh=ctnKrlZlC9i41gZd4wzwt14jBTE8bLOOurempFZmoAY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=1vo36p01BPKpiMR5B+matWu9DFlgtLQNAUik9HH/iapbqTmvb4iDutl6StolAPjwZ u+VYrRvBSSTB4wvDNyDkcIoJRw0Ef+KyWkiwdERAN9QH80mUuqNMDeVPu+vF1YvnaS UIdJjXlhMXYQEh2XT3jTgrsf19JR3l+kYamN1KQQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2393900AbgFSPcf (ORCPT ); Fri, 19 Jun 2020 11:32:35 -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 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@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;