Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 162b27ae authored by Jaegeuk Kim's avatar Jaegeuk Kim
Browse files

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: default avatarChao Yu <yuchao0@huawei.com>
Signed-off-by: default avatarJaegeuk Kim <jaegeuk@kernel.org>
parent b6a06cbb
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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;
}