Skip to content

Commit

Permalink
f2fs: fix reference leaks in f2fs_acl_create
Browse files Browse the repository at this point in the history
Our f2fs_acl_create is copied and modified from posix_acl_create to avoid
deadlock bug when inline_dentry feature is enabled.

Now, we got reference leaks in posix_acl_create, and this has been fixed in
commit fed0b58 ("posix_acl: fix reference leaks in posix_acl_create")
by Omar Sandoval.
https://lkml.org/lkml/2015/2/9/5

Let's fix this issue in f2fs_acl_create too.

Signed-off-by: Chao Yu <chao2.yu@samsung.com>
Reviewed-by: Changman Lee <cm224.lee@ssamsung.com>
Signed-off-by: Jaegeuk Kim <jaegeuk@kernel.org>
  • Loading branch information
Chao Yu authored and Jaegeuk Kim committed Apr 10, 2015
1 parent bda1907 commit 83dfe53
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions fs/f2fs/acl.c
Original file line number Diff line number Diff line change
Expand Up @@ -351,13 +351,11 @@ static int f2fs_acl_create(struct inode *dir, umode_t *mode,

*acl = f2fs_acl_clone(p, GFP_NOFS);
if (!*acl)
return -ENOMEM;
goto no_mem;

ret = f2fs_acl_create_masq(*acl, mode);
if (ret < 0) {
posix_acl_release(*acl);
return -ENOMEM;
}
if (ret < 0)
goto no_mem_clone;

if (ret == 0) {
posix_acl_release(*acl);
Expand All @@ -378,6 +376,12 @@ static int f2fs_acl_create(struct inode *dir, umode_t *mode,
*default_acl = NULL;
*acl = NULL;
return 0;

no_mem_clone:
posix_acl_release(*acl);
no_mem:
posix_acl_release(p);
return -ENOMEM;
}

int f2fs_init_acl(struct inode *inode, struct inode *dir, struct page *ipage,
Expand Down

0 comments on commit 83dfe53

Please sign in to comment.