summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorMark Salyzyn <salyzyn@google.com>2017-01-23 12:56:41 -0800
committerDennis Cagle <d-cagle@codeaurora.org>2017-04-21 11:11:43 -0700
commit1cfb2113468a2d82c28c596bfa271c9dea2a4c5e (patch)
treede04cf4059563fdf07b90cde10fb780872c652b4 /fs
parentbea6f1c7796da9d18404fdea08625644ba6fb73a (diff)
ANDROID: fix acl leaks
Fixes regressions associated with commit 073931017b49 ("posix_acl: Clear SGID bit when setting file permissions") Signed-off-by: Mark Salyzyn <salyzyn@google.com> Bug: 32458736 Change-Id: I6ee127dfdf3594d24ccd8560541ac554c5b05eb6 [d-cagle@codeaurora.org: Resolve merge conflicts] Git-repo: https://android.googlesource.com/kernel/msm/ Git-commit: 74d0e4d3d96d0ca82d39635318a69d55e966b767 Signed-off-by: Dennis Cagle <d-cagle@codeaurora.org>
Diffstat (limited to 'fs')
-rw-r--r--fs/gfs2/acl.c5
-rw-r--r--fs/xfs/xfs_acl.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/fs/gfs2/acl.c b/fs/gfs2/acl.c
index ff0ac96a8e7b..db4c867369b5 100644
--- a/fs/gfs2/acl.c
+++ b/fs/gfs2/acl.c
@@ -78,8 +78,11 @@ int gfs2_set_acl(struct inode *inode, struct posix_acl *acl, int type)
if (type == ACL_TYPE_ACCESS) {
umode_t mode = inode->i_mode;
-
+ struct posix_acl *old_acl = acl;
error = posix_acl_update_mode(inode, &inode->i_mode, &acl);
+
+ if (!acl)
+ posix_acl_release(old_acl);
if (error)
return error;
if (mode != inode->i_mode)
diff --git a/fs/xfs/xfs_acl.c b/fs/xfs/xfs_acl.c
index c5101a3295d8..62ba66e1c598 100644
--- a/fs/xfs/xfs_acl.c
+++ b/fs/xfs/xfs_acl.c
@@ -289,8 +289,10 @@ xfs_set_acl(struct inode *inode, struct posix_acl *acl, int type)
if (type == ACL_TYPE_ACCESS) {
umode_t mode;
-
+ struct posix_acl *old_acl = acl;
error = posix_acl_update_mode(inode, &mode, &acl);
+ if (!acl)
+ posix_acl_release(old_acl);
if (error)
return error;
error = xfs_set_mode(inode, mode);