Commit fed0b588 authored by Omar Sandoval's avatar Omar Sandoval Committed by Al Viro

posix_acl: fix reference leaks in posix_acl_create

get_acl gets a reference which we must release in the error cases.
Reviewed-by: default avatarChristoph Hellwig <hch@lst.de>
Signed-off-by: default avatarOmar Sandoval <osandov@osandov.com>
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 76bf3f6b
...@@ -564,13 +564,11 @@ posix_acl_create(struct inode *dir, umode_t *mode, ...@@ -564,13 +564,11 @@ posix_acl_create(struct inode *dir, umode_t *mode,
*acl = posix_acl_clone(p, GFP_NOFS); *acl = posix_acl_clone(p, GFP_NOFS);
if (!*acl) if (!*acl)
return -ENOMEM; goto no_mem;
ret = posix_acl_create_masq(*acl, mode); ret = posix_acl_create_masq(*acl, mode);
if (ret < 0) { if (ret < 0)
posix_acl_release(*acl); goto no_mem_clone;
return -ENOMEM;
}
if (ret == 0) { if (ret == 0) {
posix_acl_release(*acl); posix_acl_release(*acl);
...@@ -591,6 +589,12 @@ posix_acl_create(struct inode *dir, umode_t *mode, ...@@ -591,6 +589,12 @@ posix_acl_create(struct inode *dir, umode_t *mode,
*default_acl = NULL; *default_acl = NULL;
*acl = NULL; *acl = NULL;
return 0; return 0;
no_mem_clone:
posix_acl_release(*acl);
no_mem:
posix_acl_release(p);
return -ENOMEM;
} }
EXPORT_SYMBOL_GPL(posix_acl_create); EXPORT_SYMBOL_GPL(posix_acl_create);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment