@@ -89,12 +89,14 @@ static int exfat_cont_expand(struct inode *inode, loff_t size)
89
89
return - EIO ;
90
90
}
91
91
92
- static bool exfat_allow_set_time (struct exfat_sb_info * sbi , struct inode * inode )
92
+ static bool exfat_allow_set_time (struct mnt_idmap * idmap ,
93
+ struct exfat_sb_info * sbi , struct inode * inode )
93
94
{
94
95
mode_t allow_utime = sbi -> options .allow_utime ;
95
96
96
- if (!uid_eq (current_fsuid (), inode -> i_uid )) {
97
- if (in_group_p (inode -> i_gid ))
97
+ if (!vfsuid_eq_kuid (i_uid_into_vfsuid (idmap , inode ),
98
+ current_fsuid ())) {
99
+ if (vfsgid_in_group_p (i_gid_into_vfsgid (idmap , inode )))
98
100
allow_utime >>= 3 ;
99
101
if (allow_utime & MAY_WRITE )
100
102
return true;
@@ -283,7 +285,7 @@ int exfat_getattr(struct mnt_idmap *idmap, const struct path *path,
283
285
struct inode * inode = d_backing_inode (path -> dentry );
284
286
struct exfat_inode_info * ei = EXFAT_I (inode );
285
287
286
- generic_fillattr (& nop_mnt_idmap , request_mask , inode , stat );
288
+ generic_fillattr (idmap , request_mask , inode , stat );
287
289
exfat_truncate_atime (& stat -> atime );
288
290
stat -> result_mask |= STATX_BTIME ;
289
291
stat -> btime .tv_sec = ei -> i_crtime .tv_sec ;
@@ -311,20 +313,22 @@ int exfat_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
311
313
/* Check for setting the inode time. */
312
314
ia_valid = attr -> ia_valid ;
313
315
if ((ia_valid & (ATTR_MTIME_SET | ATTR_ATIME_SET | ATTR_TIMES_SET )) &&
314
- exfat_allow_set_time (sbi , inode )) {
316
+ exfat_allow_set_time (idmap , sbi , inode )) {
315
317
attr -> ia_valid &= ~(ATTR_MTIME_SET | ATTR_ATIME_SET |
316
318
ATTR_TIMES_SET );
317
319
}
318
320
319
- error = setattr_prepare (& nop_mnt_idmap , dentry , attr );
321
+ error = setattr_prepare (idmap , dentry , attr );
320
322
attr -> ia_valid = ia_valid ;
321
323
if (error )
322
324
goto out ;
323
325
324
326
if (((attr -> ia_valid & ATTR_UID ) &&
325
- !uid_eq (attr -> ia_uid , sbi -> options .fs_uid )) ||
327
+ (!uid_eq (from_vfsuid (idmap , i_user_ns (inode ), attr -> ia_vfsuid ),
328
+ sbi -> options .fs_uid ))) ||
326
329
((attr -> ia_valid & ATTR_GID ) &&
327
- !gid_eq (attr -> ia_gid , sbi -> options .fs_gid )) ||
330
+ (!gid_eq (from_vfsgid (idmap , i_user_ns (inode ), attr -> ia_vfsgid ),
331
+ sbi -> options .fs_gid ))) ||
328
332
((attr -> ia_valid & ATTR_MODE ) &&
329
333
(attr -> ia_mode & ~(S_IFREG | S_IFLNK | S_IFDIR | 0777 )))) {
330
334
error = - EPERM ;
@@ -343,7 +347,7 @@ int exfat_setattr(struct mnt_idmap *idmap, struct dentry *dentry,
343
347
if (attr -> ia_valid & ATTR_SIZE )
344
348
inode_set_mtime_to_ts (inode , inode_set_ctime_current (inode ));
345
349
346
- setattr_copy (& nop_mnt_idmap , inode , attr );
350
+ setattr_copy (idmap , inode , attr );
347
351
exfat_truncate_inode_atime (inode );
348
352
349
353
if (attr -> ia_valid & ATTR_SIZE ) {
0 commit comments