diff options
author | Chao Yu <chao2.yu@samsung.com> | 2015-05-13 18:20:54 +0800 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2015-06-01 16:20:57 -0700 |
commit | 7bf4b5576af816f3f40bf3b99f0257e6c14bd35c (patch) | |
tree | 282f899e87de3d74c2bedab8ec8d021b434e24a9 /fs/f2fs | |
parent | ca40b0305209248e5fd05f6ba8a3874656ff0117 (diff) | |
download | linux-7bf4b5576af816f3f40bf3b99f0257e6c14bd35c.tar.bz2 |
f2fs crypto: fix to release buffer for fname crypto
This patch fixes memory leak issue in error path of f2fs_fname_setup_filename().
Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/crypto_fname.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/fs/f2fs/crypto_fname.c b/fs/f2fs/crypto_fname.c index e3a1bdc70b03..016c4b63b53d 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; } |