Skip to content

Commit 488c8ef

Browse files
committed
ocfs2: Compare kuids and kgids using uid_eq and gid_eq
Cc: Mark Fasheh <mfasheh@suse.com> Cc: Joel Becker <jlbec@evilplan.org> Signed-off-by: "Eric W. Biederman" <ebiederm@xmission.com>
1 parent ba61356 commit 488c8ef

2 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎fs/ocfs2/file.c‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1175,14 +1175,14 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
11751175
}
11761176
}
11771177

1178-
if ((attr->ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid) ||
1179-
(attr->ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid)) {
1178+
if ((attr->ia_valid & ATTR_UID && !uid_eq(attr->ia_uid, inode->i_uid)) ||
1179+
(attr->ia_valid & ATTR_GID && !gid_eq(attr->ia_gid, inode->i_gid))) {
11801180
/*
11811181
* Gather pointers to quota structures so that allocation /
11821182
* freeing of quota structures happens here and not inside
11831183
* dquot_transfer() where we have problems with lock ordering
11841184
*/
1185-
if (attr->ia_valid & ATTR_UID && attr->ia_uid != inode->i_uid
1185+
if (attr->ia_valid & ATTR_UID && !uid_eq(attr->ia_uid, inode->i_uid)
11861186
&& OCFS2_HAS_RO_COMPAT_FEATURE(sb,
11871187
OCFS2_FEATURE_RO_COMPAT_USRQUOTA)) {
11881188
transfer_to[USRQUOTA] = dqget(sb, make_kqid_uid(attr->ia_uid));
@@ -1191,7 +1191,7 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
11911191
goto bail_unlock;
11921192
}
11931193
}
1194-
if (attr->ia_valid & ATTR_GID && attr->ia_gid != inode->i_gid
1194+
if (attr->ia_valid & ATTR_GID && !gid_eq(attr->ia_gid, inode->i_gid)
11951195
&& OCFS2_HAS_RO_COMPAT_FEATURE(sb,
11961196
OCFS2_FEATURE_RO_COMPAT_GRPQUOTA)) {
11971197
transfer_to[GRPQUOTA] = dqget(sb, make_kqid_gid(attr->ia_gid));

‎fs/ocfs2/refcounttree.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4407,7 +4407,7 @@ static int ocfs2_vfs_reflink(struct dentry *old_dentry, struct inode *dir,
44074407
* rights to do so.
44084408
*/
44094409
if (preserve) {
4410-
if ((current_fsuid() != inode->i_uid) && !capable(CAP_CHOWN))
4410+
if (!uid_eq(current_fsuid(), inode->i_uid) && !capable(CAP_CHOWN))
44114411
return -EPERM;
44124412
if (!in_group_p(inode->i_gid) && !capable(CAP_CHOWN))
44134413
return -EPERM;

0 commit comments

Comments
 (0)