{
int ret;
struct user_namespace *ns = inode_userns(inode);
+ int mask = MAY_EXEC;
+ if (flags & IPERM_FLAG_RCU)
+ mask |= MAY_NOT_BLOCK;
if (inode->i_op->permission) {
- ret = inode->i_op->permission(inode, MAY_EXEC, flags);
+ ret = inode->i_op->permission(inode, mask, flags);
if (likely(!ret))
goto ok;
} else {
- ret = acl_permission_check(inode, MAY_EXEC, flags);
+ ret = acl_permission_check(inode, mask, flags);
if (likely(!ret))
goto ok;
if (ret != -EACCES)
if (!table) /* global root - r-xr-xr-x */
error = mask & MAY_WRITE ? -EACCES : 0;
else /* Use the permissions on the sysctl table entry */
- error = sysctl_perm(head->root, table, mask);
+ error = sysctl_perm(head->root, table, mask & ~MAY_NOT_BLOCK);
sysctl_head_finish(head);
return error;