Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933721AbbEMKVn (ORCPT ); Wed, 13 May 2015 06:21:43 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:32004 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932954AbbEMKVl (ORCPT ); Wed, 13 May 2015 06:21:41 -0400 X-AuditID: cbfee61b-f79536d000000f1f-95-555325b3bc61 From: Chao Yu To: Jaegeuk Kim , Changman Lee Cc: linux-f2fs-devel@lists.sourceforge.net, linux-kernel@vger.kernel.org Subject: [PATCH] f2fs crypto: fix to release buffer for fname crypto Date: Wed, 13 May 2015 18:20:54 +0800 Message-id: <00d401d08d66$98623d20$c926b760$@samsung.com> MIME-version: 1.0 Content-type: text/plain; charset=us-ascii Content-transfer-encoding: 7bit X-Mailer: Microsoft Outlook 14.0 Thread-index: AdCNZSeek5ZJJm3FSjO3Yisr1fxKsA== Content-language: zh-cn X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrELMWRmVeSWpSXmKPExsVy+t9jQd3NqsGhBl3neSyu7Wtksniyfhaz xaVF7haXd81hc2Dx2LSqk81j94LPTB59W1YxenzeJBfAEsVlk5Kak1mWWqRvl8CVcfRKA0vB XJ6K/uObmRsYX3F2MXJySAiYSGzd1c8CYYtJXLi3nq2LkYtDSGA6o8Skbd3sEM4rRokLZ74z g1SxCahILO/4zwRiiwh4SUzafwKsm1nAQ6Kx4zsriC0s4CLxaMc9NhCbRUBVYu7WbYxdjBwc vAKWEq9X2YCEeQUEJX5MvgfVqiWxfudxJghbXmLzmrfMEAcpSOw4+5oRYpWexI2rP9kgasQl Nh65xTKBUWAWklGzkIyahWTULCQtCxhZVjGKphYkFxQnpeca6RUn5haX5qXrJefnbmIEh/Qz 6R2MqxosDjEKcDAq8fAqbAgKFWJNLCuuzD3EKMHBrCTC+14iOFSINyWxsiq1KD++qDQntfgQ ozQHi5I478l8n1AhgfTEktTs1NSC1CKYLBMHp1QD44asrdJfC/5r8X+42/x2ncmG+b+upTHv +dWXw7BLLUtvZf3WTnm3JW6nw1PfmufWN7zcaNdzZHO7fNchCZfpQYVR7Uumr1mhxvl4+ZfX F+6KOzzbJqWtu/vjpy6P/47h7t/TC+e0bzc+GXqhJMyEdwrLp/rd4UsmxoeuuGypZrwnY/uh ZdYW+5RYijMSDbWYi4oTAedKfHllAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1758 Lines: 57 This patch fixes memory leak issue in error path of f2fs_fname_setup_filename(). Signed-off-by: Chao Yu --- fs/f2fs/crypto_fname.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/fs/f2fs/crypto_fname.c b/fs/f2fs/crypto_fname.c index e3a1bdc..016c4b6 100644 --- a/fs/f2fs/crypto_fname.c +++ b/fs/f2fs/crypto_fname.c @@ -425,7 +425,7 @@ int f2fs_fname_setup_filename(struct inode *dir, const struct qstr *iname, if (!f2fs_encrypted_inode(dir) || is_dot_dotdot(iname)) { fname->disk_name.name = (unsigned char *)iname->name; fname->disk_name.len = iname->len; - goto out; + return 0; } ret = f2fs_setup_fname_crypto(dir); if (ret) @@ -435,14 +435,13 @@ int f2fs_fname_setup_filename(struct inode *dir, const struct qstr *iname, ret = f2fs_fname_crypto_alloc_buffer(dir, iname->len, &fname->crypto_buf); if (ret < 0) - goto out; + return ret; ret = f2fs_fname_encrypt(dir, iname, &fname->crypto_buf); if (ret < 0) goto out; fname->disk_name.name = fname->crypto_buf.name; fname->disk_name.len = fname->crypto_buf.len; - ret = 0; - goto out; + return 0; } if (!lookup) { ret = -EACCES; @@ -476,8 +475,9 @@ int f2fs_fname_setup_filename(struct inode *dir, const struct qstr *iname, fname->disk_name.name = fname->crypto_buf.name; fname->disk_name.len = fname->crypto_buf.len; } - ret = 0; + return 0; out: + f2fs_fname_crypto_free_buffer(&fname->crypto_buf); return ret; } -- 2.3.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/