->permission() sanitizing: don't pass flags to generic_permission()
redundant; all callers get it duplicated in mask & MAY_NOT_BLOCK and none of them removes that bit. Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
Родитель
7e40145eb1
Коммит
2830ba7f34
|
@ -350,7 +350,7 @@ int afs_permission(struct inode *inode, int mask, unsigned int flags)
|
|||
}
|
||||
|
||||
key_put(key);
|
||||
ret = generic_permission(inode, mask, flags);
|
||||
ret = generic_permission(inode, mask);
|
||||
_leave(" = %d", ret);
|
||||
return ret;
|
||||
|
||||
|
|
|
@ -7339,7 +7339,7 @@ static int btrfs_permission(struct inode *inode, int mask, unsigned int flags)
|
|||
return -EROFS;
|
||||
if ((BTRFS_I(inode)->flags & BTRFS_INODE_READONLY) && (mask & MAY_WRITE))
|
||||
return -EACCES;
|
||||
return generic_permission(inode, mask, flags);
|
||||
return generic_permission(inode, mask);
|
||||
}
|
||||
|
||||
static const struct inode_operations btrfs_dir_inode_operations = {
|
||||
|
|
|
@ -1805,7 +1805,7 @@ int ceph_permission(struct inode *inode, int mask, unsigned int flags)
|
|||
err = ceph_do_getattr(inode, CEPH_CAP_AUTH_SHARED);
|
||||
|
||||
if (!err)
|
||||
err = generic_permission(inode, mask, flags);
|
||||
err = generic_permission(inode, mask);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
|
@ -239,7 +239,7 @@ static int cifs_permission(struct inode *inode, int mask, unsigned int flags)
|
|||
on the client (above and beyond ACL on servers) for
|
||||
servers which do not support setting and viewing mode bits,
|
||||
so allowing client to check permissions is useful */
|
||||
return generic_permission(inode, mask, flags);
|
||||
return generic_permission(inode, mask);
|
||||
}
|
||||
|
||||
static struct kmem_cache *cifs_inode_cachep;
|
||||
|
|
|
@ -1018,7 +1018,7 @@ static int fuse_permission(struct inode *inode, int mask, unsigned int flags)
|
|||
}
|
||||
|
||||
if (fc->flags & FUSE_DEFAULT_PERMISSIONS) {
|
||||
err = generic_permission(inode, mask, flags);
|
||||
err = generic_permission(inode, mask);
|
||||
|
||||
/* If permission is denied, try to refresh file
|
||||
attributes. This is also needed, because the root
|
||||
|
@ -1026,8 +1026,7 @@ static int fuse_permission(struct inode *inode, int mask, unsigned int flags)
|
|||
if (err == -EACCES && !refreshed) {
|
||||
err = fuse_perm_getattr(inode, flags);
|
||||
if (!err)
|
||||
err = generic_permission(inode, mask,
|
||||
flags);
|
||||
err = generic_permission(inode, mask);
|
||||
}
|
||||
|
||||
/* Note: the opposite of the above test does not
|
||||
|
|
|
@ -1564,7 +1564,7 @@ int gfs2_permission(struct inode *inode, int mask, unsigned int flags)
|
|||
if ((mask & MAY_WRITE) && IS_IMMUTABLE(inode))
|
||||
error = -EACCES;
|
||||
else
|
||||
error = generic_permission(inode, mask, flags);
|
||||
error = generic_permission(inode, mask);
|
||||
if (unlock)
|
||||
gfs2_glock_dq_uninit(&i_gh);
|
||||
|
||||
|
|
|
@ -770,7 +770,7 @@ int hostfs_permission(struct inode *ino, int desired, unsigned int flags)
|
|||
err = access_file(name, r, w, x);
|
||||
__putname(name);
|
||||
if (!err)
|
||||
err = generic_permission(ino, desired, flags);
|
||||
err = generic_permission(ino, desired);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
|
|
@ -398,7 +398,7 @@ again:
|
|||
hpfs_unlock(dir->i_sb);
|
||||
return -ENOSPC;
|
||||
}
|
||||
if (generic_permission(inode, MAY_WRITE, 0) ||
|
||||
if (generic_permission(inode, MAY_WRITE) ||
|
||||
!S_ISREG(inode->i_mode) ||
|
||||
get_write_access(inode)) {
|
||||
d_rehash(dentry);
|
||||
|
|
|
@ -224,7 +224,7 @@ other_perms:
|
|||
* request cannot be satisfied (eg. requires blocking or too much complexity).
|
||||
* It would then be called again in ref-walk mode.
|
||||
*/
|
||||
int generic_permission(struct inode *inode, int mask, unsigned int flags)
|
||||
int generic_permission(struct inode *inode, int mask)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
@ -289,7 +289,7 @@ int inode_permission(struct inode *inode, int mask)
|
|||
if (inode->i_op->permission)
|
||||
retval = inode->i_op->permission(inode, mask, 0);
|
||||
else
|
||||
retval = generic_permission(inode, mask, 0);
|
||||
retval = generic_permission(inode, mask);
|
||||
|
||||
if (retval)
|
||||
return retval;
|
||||
|
|
|
@ -2328,7 +2328,7 @@ out:
|
|||
out_notsup:
|
||||
res = nfs_revalidate_inode(NFS_SERVER(inode), inode);
|
||||
if (res == 0)
|
||||
res = generic_permission(inode, mask, flags);
|
||||
res = generic_permission(inode, mask);
|
||||
goto out;
|
||||
}
|
||||
|
||||
|
|
|
@ -806,7 +806,7 @@ int nilfs_permission(struct inode *inode, int mask, unsigned int flags)
|
|||
root->cno != NILFS_CPTREE_CURRENT_CNO)
|
||||
return -EROFS; /* snapshot is not writable */
|
||||
|
||||
return generic_permission(inode, mask, flags);
|
||||
return generic_permission(inode, mask);
|
||||
}
|
||||
|
||||
int nilfs_load_inode_block(struct inode *inode, struct buffer_head **pbh)
|
||||
|
|
|
@ -1293,7 +1293,7 @@ int ocfs2_permission(struct inode *inode, int mask, unsigned int flags)
|
|||
goto out;
|
||||
}
|
||||
|
||||
ret = generic_permission(inode, mask, flags);
|
||||
ret = generic_permission(inode, mask);
|
||||
|
||||
ocfs2_inode_unlock(inode, 0);
|
||||
out:
|
||||
|
|
|
@ -2169,7 +2169,7 @@ static const struct file_operations proc_fd_operations = {
|
|||
*/
|
||||
static int proc_fd_permission(struct inode *inode, int mask, unsigned int flags)
|
||||
{
|
||||
int rv = generic_permission(inode, mask, flags);
|
||||
int rv = generic_permission(inode, mask);
|
||||
if (rv == 0)
|
||||
return 0;
|
||||
if (task_pid(current) == proc_pid(inode))
|
||||
|
|
|
@ -967,7 +967,7 @@ int reiserfs_permission(struct inode *inode, int mask, unsigned int flags)
|
|||
if (IS_PRIVATE(inode))
|
||||
return 0;
|
||||
|
||||
return generic_permission(inode, mask, flags);
|
||||
return generic_permission(inode, mask);
|
||||
}
|
||||
|
||||
static int xattr_hide_revalidate(struct dentry *dentry, struct nameidata *nd)
|
||||
|
|
|
@ -362,5 +362,5 @@ int sysfs_permission(struct inode *inode, int mask, unsigned int flags)
|
|||
sysfs_refresh_inode(sd, inode);
|
||||
mutex_unlock(&sysfs_mutex);
|
||||
|
||||
return generic_permission(inode, mask, flags);
|
||||
return generic_permission(inode, mask);
|
||||
}
|
||||
|
|
|
@ -2188,7 +2188,7 @@ extern sector_t bmap(struct inode *, sector_t);
|
|||
#endif
|
||||
extern int notify_change(struct dentry *, struct iattr *);
|
||||
extern int inode_permission(struct inode *, int);
|
||||
extern int generic_permission(struct inode *, int, unsigned int);
|
||||
extern int generic_permission(struct inode *, int);
|
||||
|
||||
static inline bool execute_ok(struct inode *inode)
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче