ANDROID: fix acl leaks

Fixes regressions associated with commit
073931017b49d9458aa351605b43a7e34598caef

Signed-off-by: Mark Salyzyn <salyzyn@google.com>
Bug: 32458736
Change-Id: I6ee127dfdf3594d24ccd8560541ac554c5b05eb6
[stummala@codeaurora.org: Fixed merge conflicts]
Signed-off-by: Sahitya Tummala <stummala@codeaurora.org>
This commit is contained in:
Mark Salyzyn 2017-01-23 12:56:41 -08:00 committed by Gerrit - the friendly Code Review server
parent 0a4d95d83e
commit fdb66128fc
3 changed files with 15 additions and 19 deletions

View File

@ -268,16 +268,13 @@ static int gfs2_xattr_system_set(struct dentry *dentry, const char *name,
if (type == ACL_TYPE_ACCESS) {
umode_t mode;
struct posix_acl *old_acl = acl;
error = posix_acl_update_mode(inode, &mode, &acl);
if (error <= 0) {
posix_acl_release(acl);
acl = NULL;
if (error < 0)
return error;
}
if (!acl)
posix_acl_release(old_acl);
if (error)
goto out_release;
error = gfs2_set_mode(inode, mode);
if (error)

View File

@ -693,11 +693,13 @@ static int can_set_system_xattr(struct inode *inode, const char *name,
return rc;
}
if (acl) {
rc = posix_acl_equiv_mode(acl, &inode->i_mode);
posix_acl_release(acl);
struct posix_acl *old_acl = acl;
rc = posix_acl_update_mode(inode, &inode->i_mode, &acl);
posix_acl_release(old_acl);
if (rc < 0) {
printk(KERN_ERR
"posix_acl_equiv_mode returned %d\n",
"posix_acl_update_mode returned %d\n",
rc);
return rc;
}

View File

@ -389,16 +389,13 @@ xfs_xattr_acl_set(struct dentry *dentry, const char *name,
if (type == ACL_TYPE_ACCESS) {
umode_t mode;
struct posix_acl *old_acl = acl;
error = posix_acl_update_mode(inode, &mode, &acl);
if (error <= 0) {
posix_acl_release(acl);
acl = NULL;
if (error < 0)
return error;
}
if (!acl)
posix_acl_release(old_acl);
if (error)
goto out_release;
error = xfs_set_mode(inode, mode);
if (error)