From 5ebe362c0c604afba0dd5c2cdf9c500e9f15f1de Mon Sep 17 00:00:00 2001 From: Jaegeuk Kim Date: Thu, 8 Mar 2018 20:47:33 -0800 Subject: [PATCH] f2fs: avoid selinux denial on CAP_SYS_RESOURCE This fixes CAP_SYS_RESOURCE denial of selinux when using resgid, since it seems selinux reports it at the first place, but mostly we don't need to check this condition first. Reviewed-by: Chao Yu Signed-off-by: Jaegeuk Kim --- fs/f2fs/f2fs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/fs/f2fs/f2fs.h b/fs/f2fs/f2fs.h index 7bf9d61593a7..ca3713633500 100644 --- a/fs/f2fs/f2fs.h +++ b/fs/f2fs/f2fs.h @@ -1607,13 +1607,13 @@ static inline bool __allow_reserved_blocks(struct f2fs_sb_info *sbi, return false; if (IS_NOQUOTA(inode)) return true; - if (capable(CAP_SYS_RESOURCE)) - return true; if (uid_eq(sbi->s_resuid, current_fsuid())) return true; if (!gid_eq(sbi->s_resgid, GLOBAL_ROOT_GID) && in_group_p(sbi->s_resgid)) return true; + if (capable(CAP_SYS_RESOURCE)) + return true; return false; } -- 2.20.1