Skip to content

Commit

Permalink
if
Browse files Browse the repository at this point in the history
  • Loading branch information
anodos325 committed May 2, 2023
1 parent a13fef4 commit c36e8a7
Showing 1 changed file with 11 additions and 17 deletions.
28 changes: 11 additions & 17 deletions module/os/linux/zfs/zpl_xattr.c
Original file line number Diff line number Diff line change
Expand Up @@ -1514,21 +1514,14 @@ zpl_permission(struct inode *ip, int mask)
}

/*
* Fast path for execute checks. This is not authoritative as user may
* have explicit entry granting execute or be member of group granting
* execute.
* Fast path for execute checks. Do not use zfs_fastaccesschk_execute
* since it may end up granting execute access in presence of explicit
* deny entry for user / group, and it also read the ZFS ACL
* (non-cached) which we wish to avoid in RCU.
*/
if (to_check == ACE_EXECUTE) {
#if defined(HAVE_IOPS_PERMISSION_USERNS)
if ((ITOZ(ip)->z_pflags & ZFS_NO_EXECS_DENIED) ||
(generic_permission(userns, ip, mask) == 0)) {
#else
if ((ITOZ(ip)->z_pflags & ZFS_NO_EXECS_DENIED) ||
(generic_permission(ip, mask) == 0)) {
#endif
if ((to_check == ACE_EXECUTE) &&
(ITOZ(ip)->z_pflags & ZFS_NO_EXECS_DENIED))
return (0);
}
}

/*
* inode permission operation may be called in rcu-walk mode
Expand All @@ -1538,10 +1531,6 @@ zpl_permission(struct inode *ip, int mask)
* If a situation is encountered that rcu-walk cannot handle,
* return -ECHILD and it will be called again in ref-walk mode.
*/
if (mask & MAY_NOT_BLOCK) {
return (-ECHILD);
}

cr = CRED();
crhold(cr);

Expand Down Expand Up @@ -1590,6 +1579,11 @@ zpl_permission(struct inode *ip, int mask)
return (0);
}

if (mask & MAY_NOT_BLOCK) {
crfree(cr);
return (-ECHILD);
}

ret = -zfs_access(ITOZ(ip), to_check, V_ACE_MASK, cr);
crfree(cr);
return (ret);
Expand Down

0 comments on commit c36e8a7

Please sign in to comment.