summaryrefslogtreecommitdiffstats
path: root/fs/posix_acl.c
diff options
context:
space:
mode:
authorOmar Sandoval <osandov@osandov.com>2015-02-08 21:45:25 -0800
committerAl Viro <viro@zeniv.linux.org.uk>2015-02-20 04:56:45 -0500
commitfed0b588be2f55822013808a2968c228258d921b (patch)
tree9d7a658a615c08c104a1566620379c21f8d1a7d3 /fs/posix_acl.c
parent76bf3f6b1d6ac4c770bb121b0461c460aa068e64 (diff)
downloadop-kernel-dev-fed0b588be2f55822013808a2968c228258d921b.zip
op-kernel-dev-fed0b588be2f55822013808a2968c228258d921b.tar.gz
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/posix_acl.c')
-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 0855f77..515d315 100644
--- a/fs/posix_acl.c
+++ b/fs/posix_acl.c
@@ -564,13 +564,11 @@ posix_acl_create(struct inode *dir, umode_t *mode,
*acl = posix_acl_clone(p, GFP_NOFS);
if (!*acl)
- return -ENOMEM;
+ goto no_mem;
ret = posix_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);
@@ -591,6 +589,12 @@ no_acl:
*default_acl = NULL;
*acl = NULL;
return 0;
+
+no_mem_clone:
+ posix_acl_release(*acl);
+no_mem:
+ posix_acl_release(p);
+ return -ENOMEM;
}
EXPORT_SYMBOL_GPL(posix_acl_create);
OpenPOWER on IntegriCloud