diff options
author | Chao Yu <chao2.yu@samsung.com> | 2015-03-09 06:18:19 -0400 |
---|---|---|
committer | Jaegeuk Kim <jaegeuk@kernel.org> | 2015-04-10 18:08:40 -0400 |
commit | 83dfe53c185e3554c102708c70dc1e5ff4bcac2c (patch) | |
tree | bae8a4029027a8f3327745eed2a074e30331f32f /fs/f2fs | |
parent | bda190760b07a7350de7ca8d9afe0fd8c667ad2d (diff) |
f2fs: fix reference leaks in f2fs_acl_create
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 fed0b588be2f ("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>
Diffstat (limited to 'fs/f2fs')
-rw-r--r-- | fs/f2fs/acl.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/fs/f2fs/acl.c b/fs/f2fs/acl.c index 742202779bd5..4320ffab3495 100644 --- a/fs/f2fs/acl.c +++ b/fs/f2fs/acl.c | |||
@@ -351,13 +351,11 @@ static int f2fs_acl_create(struct inode *dir, umode_t *mode, | |||
351 | 351 | ||
352 | *acl = f2fs_acl_clone(p, GFP_NOFS); | 352 | *acl = f2fs_acl_clone(p, GFP_NOFS); |
353 | if (!*acl) | 353 | if (!*acl) |
354 | return -ENOMEM; | 354 | goto no_mem; |
355 | 355 | ||
356 | ret = f2fs_acl_create_masq(*acl, mode); | 356 | ret = f2fs_acl_create_masq(*acl, mode); |
357 | if (ret < 0) { | 357 | if (ret < 0) |
358 | posix_acl_release(*acl); | 358 | goto no_mem_clone; |
359 | return -ENOMEM; | ||
360 | } | ||
361 | 359 | ||
362 | if (ret == 0) { | 360 | if (ret == 0) { |
363 | posix_acl_release(*acl); | 361 | posix_acl_release(*acl); |
@@ -378,6 +376,12 @@ no_acl: | |||
378 | *default_acl = NULL; | 376 | *default_acl = NULL; |
379 | *acl = NULL; | 377 | *acl = NULL; |
380 | return 0; | 378 | return 0; |
379 | |||
380 | no_mem_clone: | ||
381 | posix_acl_release(*acl); | ||
382 | no_mem: | ||
383 | posix_acl_release(p); | ||
384 | return -ENOMEM; | ||
381 | } | 385 | } |
382 | 386 | ||
383 | int f2fs_init_acl(struct inode *inode, struct inode *dir, struct page *ipage, | 387 | int f2fs_init_acl(struct inode *inode, struct inode *dir, struct page *ipage, |