From d07cd2d3ecc97a863f15b8c8a91cd9bf9e4e6198 Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim Date: Tue, 22 Nov 2016 15:49:17 -0800 Subject: [PATCH] posix_acl: Clear SGID bit when setting file permissions Cherry-pick to f2fs only for generic/375 from: (073931017: posix_acl: Clear SGID bit when setting file permissions) Change-Id: I687da0b80dc1f8bead35137b5954ff922588f19a Signed-off-by: Jaegeuk Kim CVE-2016-7097 Signed-off-by: Kevin F. Haggerty --- fs/f2fs/acl.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/fs/f2fs/acl.c b/fs/f2fs/acl.c index f431f992555..97b32bf9b5e 100644 --- a/fs/f2fs/acl.c +++ b/fs/f2fs/acl.c @@ -211,12 +211,10 @@ static int f2fs_set_acl(struct inode *inode, int type, case ACL_TYPE_ACCESS: name_index = F2FS_XATTR_INDEX_POSIX_ACL_ACCESS; if (acl) { - error = posix_acl_equiv_mode(acl, &inode->i_mode); - if (error < 0) + error = posix_acl_update_mode(inode, &inode->i_mode, &acl); + if (error) return error; set_acl_inode(inode, inode->i_mode); - if (error == 0) - acl = NULL; } break;