diff options
author | Hyunchul Lee <cheol.lee@lge.com> | 2017-05-17 08:58:02 +0900 |
---|---|---|
committer | Richard Weinberger <richard@nod.at> | 2017-07-14 22:49:05 +0200 |
commit | bb50c63244687706e11c9b636a5ad3090cd783ac (patch) | |
tree | 68e8816798e804db7259ac49f95ca6b916529636 /fs/ubifs | |
parent | 4d35ca4f774c29ec9ed676fd5112bfc83ef9853e (diff) | |
download | linux-stable-bb50c63244687706e11c9b636a5ad3090cd783ac.tar.gz linux-stable-bb50c63244687706e11c9b636a5ad3090cd783ac.tar.bz2 linux-stable-bb50c63244687706e11c9b636a5ad3090cd783ac.zip |
ubifs: Fix memory leak in RENAME_WHITEOUT error path in do_rename
in RENAME_WHITEOUT error path, fscrypt_name should be freed.
Signed-off-by: Hyunchul Lee <cheol.lee@lge.com>
Signed-off-by: Richard Weinberger <richard@nod.at>
Diffstat (limited to 'fs/ubifs')
-rw-r--r-- | fs/ubifs/dir.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/fs/ubifs/dir.c b/fs/ubifs/dir.c index 4e4bf8f6320f..996e4215fd28 100644 --- a/fs/ubifs/dir.c +++ b/fs/ubifs/dir.c @@ -1396,17 +1396,14 @@ static int do_rename(struct inode *old_dir, struct dentry *old_dentry, dev = kmalloc(sizeof(union ubifs_dev_desc), GFP_NOFS); if (!dev) { - ubifs_release_budget(c, &req); - ubifs_release_budget(c, &ino_req); - return -ENOMEM; + err = -ENOMEM; + goto out_release; } err = do_tmpfile(old_dir, old_dentry, S_IFCHR | WHITEOUT_MODE, &whiteout); if (err) { - ubifs_release_budget(c, &req); - ubifs_release_budget(c, &ino_req); kfree(dev); - return err; + goto out_release; } whiteout->i_state |= I_LINKABLE; @@ -1494,12 +1491,10 @@ static int do_rename(struct inode *old_dir, struct dentry *old_dentry, err = ubifs_budget_space(c, &wht_req); if (err) { - ubifs_release_budget(c, &req); - ubifs_release_budget(c, &ino_req); kfree(whiteout_ui->data); whiteout_ui->data_len = 0; iput(whiteout); - return err; + goto out_release; } inc_nlink(whiteout); @@ -1554,6 +1549,7 @@ out_cancel: iput(whiteout); } unlock_4_inodes(old_dir, new_dir, new_inode, whiteout); +out_release: ubifs_release_budget(c, &ino_req); ubifs_release_budget(c, &req); fscrypt_free_filename(&old_nm); |