aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorOmar Sandoval <osandov@osandov.com>2015-02-09 00:45:25 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2015-02-20 04:56:45 -0500
commitfed0b588be2f55822013808a2968c228258d921b (patch)
tree9d7a658a615c08c104a1566620379c21f8d1a7d3 /fs
parent76bf3f6b1d6ac4c770bb121b0461c460aa068e64 (diff)
posix_acl: fix reference leaks in posix_acl_create
get_acl gets a reference which we must release in the error cases. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Omar Sandoval <osandov@osandov.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs')
-rw-r--r--fs/posix_acl.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/fs/posix_acl.c b/fs/posix_acl.c
index 0855f772cd41..515d31511d0d 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -564,13 +564,11 @@ posix_acl_create(struct inode *dir, umode_t *mode,
564 564
565 *acl = posix_acl_clone(p, GFP_NOFS); 565 *acl = posix_acl_clone(p, GFP_NOFS);
566 if (!*acl) 566 if (!*acl)
567 return -ENOMEM; 567 goto no_mem;
568 568
569 ret = posix_acl_create_masq(*acl, mode); 569 ret = posix_acl_create_masq(*acl, mode);
570 if (ret < 0) { 570 if (ret < 0)
571 posix_acl_release(*acl); 571 goto no_mem_clone;
572 return -ENOMEM;
573 }
574 572
575 if (ret == 0) { 573 if (ret == 0) {
576 posix_acl_release(*acl); 574 posix_acl_release(*acl);
@@ -591,6 +589,12 @@ no_acl:
591 *default_acl = NULL; 589 *default_acl = NULL;
592 *acl = NULL; 590 *acl = NULL;
593 return 0; 591 return 0;
592
593no_mem_clone:
594 posix_acl_release(*acl);
595no_mem:
596 posix_acl_release(p);
597 return -ENOMEM;
594} 598}
595EXPORT_SYMBOL_GPL(posix_acl_create); 599EXPORT_SYMBOL_GPL(posix_acl_create);
596 600