Skip to content

Commit

Permalink
->permission() sanitizing: don't pass flags to ->permission()
Browse files Browse the repository at this point in the history
not used by the instances anymore.

Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Al Viro committed Jul 20, 2011
1 parent 2830ba7 commit 10556cb
Show file tree
Hide file tree
Showing 31 changed files with 55 additions and 55 deletions.
4 changes: 2 additions & 2 deletions Documentation/filesystems/vfs.txt
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ struct inode_operations {
void * (*follow_link) (struct dentry *, struct nameidata *);
void (*put_link) (struct dentry *, struct nameidata *, void *);
void (*truncate) (struct inode *);
int (*permission) (struct inode *, int, unsigned int);
int (*permission) (struct inode *, int);
int (*check_acl)(struct inode *, int);
int (*setattr) (struct dentry *, struct iattr *);
int (*getattr) (struct vfsmount *mnt, struct dentry *, struct kstat *);
Expand Down Expand Up @@ -423,7 +423,7 @@ otherwise noted.
permission: called by the VFS to check for access rights on a POSIX-like
filesystem.

May be called in rcu-walk mode (flags & IPERM_FLAG_RCU). If in rcu-walk
May be called in rcu-walk mode (mask & MAY_NOT_BLOCK). If in rcu-walk
mode, the filesystem must check the permission without blocking or
storing to the inode.

Expand Down
2 changes: 1 addition & 1 deletion fs/afs/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ extern void afs_clear_permits(struct afs_vnode *);
extern void afs_cache_permit(struct afs_vnode *, struct key *, long);
extern void afs_zap_permits(struct rcu_head *);
extern struct key *afs_request_key(struct afs_cell *);
extern int afs_permission(struct inode *, int, unsigned int);
extern int afs_permission(struct inode *, int);

/*
* server.c
Expand Down
4 changes: 2 additions & 2 deletions fs/afs/security.c
Original file line number Diff line number Diff line change
Expand Up @@ -285,14 +285,14 @@ static int afs_check_permit(struct afs_vnode *vnode, struct key *key,
* - AFS ACLs are attached to directories only, and a file is controlled by its
* parent directory's ACL
*/
int afs_permission(struct inode *inode, int mask, unsigned int flags)
int afs_permission(struct inode *inode, int mask)
{
struct afs_vnode *vnode = AFS_FS_I(inode);
afs_access_t uninitialized_var(access);
struct key *key;
int ret;

if (flags & IPERM_FLAG_RCU)
if (mask & MAY_NOT_BLOCK)
return -ECHILD;

_enter("{{%x:%u},%lx},%x,",
Expand Down
2 changes: 1 addition & 1 deletion fs/bad_inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ static int bad_inode_readlink(struct dentry *dentry, char __user *buffer,
return -EIO;
}

static int bad_inode_permission(struct inode *inode, int mask, unsigned int flags)
static int bad_inode_permission(struct inode *inode, int mask)
{
return -EIO;
}
Expand Down
2 changes: 1 addition & 1 deletion fs/btrfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -7331,7 +7331,7 @@ static int btrfs_set_page_dirty(struct page *page)
return __set_page_dirty_nobuffers(page);
}

static int btrfs_permission(struct inode *inode, int mask, unsigned int flags)
static int btrfs_permission(struct inode *inode, int mask)
{
struct btrfs_root *root = BTRFS_I(inode)->root;

Expand Down
4 changes: 2 additions & 2 deletions fs/ceph/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -1795,11 +1795,11 @@ int ceph_do_getattr(struct inode *inode, int mask)
* Check inode permissions. We verify we have a valid value for
* the AUTH cap, then call the generic handler.
*/
int ceph_permission(struct inode *inode, int mask, unsigned int flags)
int ceph_permission(struct inode *inode, int mask)
{
int err;

if (flags & IPERM_FLAG_RCU)
if (mask & MAY_NOT_BLOCK)
return -ECHILD;

err = ceph_do_getattr(inode, CEPH_CAP_AUTH_SHARED);
Expand Down
2 changes: 1 addition & 1 deletion fs/ceph/super.h
Original file line number Diff line number Diff line change
Expand Up @@ -692,7 +692,7 @@ extern void ceph_queue_invalidate(struct inode *inode);
extern void ceph_queue_writeback(struct inode *inode);

extern int ceph_do_getattr(struct inode *inode, int mask);
extern int ceph_permission(struct inode *inode, int mask, unsigned int flags);
extern int ceph_permission(struct inode *inode, int mask);
extern int ceph_setattr(struct dentry *dentry, struct iattr *attr);
extern int ceph_getattr(struct vfsmount *mnt, struct dentry *dentry,
struct kstat *stat);
Expand Down
2 changes: 1 addition & 1 deletion fs/cifs/cifsfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ cifs_statfs(struct dentry *dentry, struct kstatfs *buf)
return 0;
}

static int cifs_permission(struct inode *inode, int mask, unsigned int flags)
static int cifs_permission(struct inode *inode, int mask)
{
struct cifs_sb_info *cifs_sb;

Expand Down
2 changes: 1 addition & 1 deletion fs/coda/coda_linux.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ extern const struct file_operations coda_ioctl_operations;
/* operations shared over more than one file */
int coda_open(struct inode *i, struct file *f);
int coda_release(struct inode *i, struct file *f);
int coda_permission(struct inode *inode, int mask, unsigned int flags);
int coda_permission(struct inode *inode, int mask);
int coda_revalidate_inode(struct dentry *);
int coda_getattr(struct vfsmount *, struct dentry *, struct kstat *);
int coda_setattr(struct dentry *, struct iattr *);
Expand Down
4 changes: 2 additions & 2 deletions fs/coda/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ static struct dentry *coda_lookup(struct inode *dir, struct dentry *entry, struc
}


int coda_permission(struct inode *inode, int mask, unsigned int flags)
int coda_permission(struct inode *inode, int mask)
{
int error;

if (flags & IPERM_FLAG_RCU)
if (mask & MAY_NOT_BLOCK)
return -ECHILD;

mask &= MAY_READ | MAY_WRITE | MAY_EXEC;
Expand Down
4 changes: 2 additions & 2 deletions fs/coda/pioctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
#include "coda_linux.h"

/* pioctl ops */
static int coda_ioctl_permission(struct inode *inode, int mask, unsigned int flags);
static int coda_ioctl_permission(struct inode *inode, int mask);
static long coda_pioctl(struct file *filp, unsigned int cmd,
unsigned long user_data);

Expand All @@ -41,7 +41,7 @@ const struct file_operations coda_ioctl_operations = {
};

/* the coda pioctl inode ops */
static int coda_ioctl_permission(struct inode *inode, int mask, unsigned int flags)
static int coda_ioctl_permission(struct inode *inode, int mask)
{
return (mask & MAY_EXEC) ? -EACCES : 0;
}
Expand Down
4 changes: 2 additions & 2 deletions fs/ecryptfs/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -942,9 +942,9 @@ int ecryptfs_truncate(struct dentry *dentry, loff_t new_length)
}

static int
ecryptfs_permission(struct inode *inode, int mask, unsigned int flags)
ecryptfs_permission(struct inode *inode, int mask)
{
if (flags & IPERM_FLAG_RCU)
if (mask & MAY_NOT_BLOCK)
return -ECHILD;
return inode_permission(ecryptfs_inode_to_lower(inode), mask);
}
Expand Down
14 changes: 7 additions & 7 deletions fs/fuse/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -971,9 +971,9 @@ static int fuse_access(struct inode *inode, int mask)
return err;
}

static int fuse_perm_getattr(struct inode *inode, int flags)
static int fuse_perm_getattr(struct inode *inode, int mask)
{
if (flags & IPERM_FLAG_RCU)
if (mask & MAY_NOT_BLOCK)
return -ECHILD;

return fuse_do_getattr(inode, NULL, NULL);
Expand All @@ -992,7 +992,7 @@ static int fuse_perm_getattr(struct inode *inode, int flags)
* access request is sent. Execute permission is still checked
* locally based on file mode.
*/
static int fuse_permission(struct inode *inode, int mask, unsigned int flags)
static int fuse_permission(struct inode *inode, int mask)
{
struct fuse_conn *fc = get_fuse_conn(inode);
bool refreshed = false;
Expand All @@ -1011,7 +1011,7 @@ static int fuse_permission(struct inode *inode, int mask, unsigned int flags)
if (fi->i_time < get_jiffies_64()) {
refreshed = true;

err = fuse_perm_getattr(inode, flags);
err = fuse_perm_getattr(inode, mask);
if (err)
return err;
}
Expand All @@ -1024,7 +1024,7 @@ static int fuse_permission(struct inode *inode, int mask, unsigned int flags)
attributes. This is also needed, because the root
node will at first have no permissions */
if (err == -EACCES && !refreshed) {
err = fuse_perm_getattr(inode, flags);
err = fuse_perm_getattr(inode, mask);
if (!err)
err = generic_permission(inode, mask);
}
Expand All @@ -1034,7 +1034,7 @@ static int fuse_permission(struct inode *inode, int mask, unsigned int flags)
noticed immediately, only after the attribute
timeout has expired */
} else if (mask & (MAY_ACCESS | MAY_CHDIR)) {
if (flags & IPERM_FLAG_RCU)
if (mask & MAY_NOT_BLOCK)
return -ECHILD;

err = fuse_access(inode, mask);
Expand All @@ -1043,7 +1043,7 @@ static int fuse_permission(struct inode *inode, int mask, unsigned int flags)
if (refreshed)
return -EACCES;

err = fuse_perm_getattr(inode, flags);
err = fuse_perm_getattr(inode, mask);
if (!err && !(inode->i_mode & S_IXUGO))
return -EACCES;
}
Expand Down
2 changes: 1 addition & 1 deletion fs/gfs2/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask)
!capable(CAP_LINUX_IMMUTABLE))
goto out;
if (!IS_IMMUTABLE(inode)) {
error = gfs2_permission(inode, MAY_WRITE, 0);
error = gfs2_permission(inode, MAY_WRITE);
if (error)
goto out;
}
Expand Down
16 changes: 8 additions & 8 deletions fs/gfs2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,7 @@ struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name,
}

if (!is_root) {
error = gfs2_permission(dir, MAY_EXEC, 0);
error = gfs2_permission(dir, MAY_EXEC);
if (error)
goto out;
}
Expand Down Expand Up @@ -337,7 +337,7 @@ static int create_ok(struct gfs2_inode *dip, const struct qstr *name,
{
int error;

error = gfs2_permission(&dip->i_inode, MAY_WRITE | MAY_EXEC, 0);
error = gfs2_permission(&dip->i_inode, MAY_WRITE | MAY_EXEC);
if (error)
return error;

Expand Down Expand Up @@ -857,7 +857,7 @@ static int gfs2_link(struct dentry *old_dentry, struct inode *dir,
if (inode->i_nlink == 0)
goto out_gunlock;

error = gfs2_permission(dir, MAY_WRITE | MAY_EXEC, 0);
error = gfs2_permission(dir, MAY_WRITE | MAY_EXEC);
if (error)
goto out_gunlock;

Expand Down Expand Up @@ -990,7 +990,7 @@ static int gfs2_unlink_ok(struct gfs2_inode *dip, const struct qstr *name,
if (IS_APPEND(&dip->i_inode))
return -EPERM;

error = gfs2_permission(&dip->i_inode, MAY_WRITE | MAY_EXEC, 0);
error = gfs2_permission(&dip->i_inode, MAY_WRITE | MAY_EXEC);
if (error)
return error;

Expand Down Expand Up @@ -1336,7 +1336,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
}
}
} else {
error = gfs2_permission(ndir, MAY_WRITE | MAY_EXEC, 0);
error = gfs2_permission(ndir, MAY_WRITE | MAY_EXEC);
if (error)
goto out_gunlock;

Expand Down Expand Up @@ -1371,7 +1371,7 @@ static int gfs2_rename(struct inode *odir, struct dentry *odentry,
/* Check out the dir to be renamed */

if (dir_rename) {
error = gfs2_permission(odentry->d_inode, MAY_WRITE, 0);
error = gfs2_permission(odentry->d_inode, MAY_WRITE);
if (error)
goto out_gunlock;
}
Expand Down Expand Up @@ -1543,7 +1543,7 @@ static void gfs2_put_link(struct dentry *dentry, struct nameidata *nd, void *p)
* Returns: errno
*/

int gfs2_permission(struct inode *inode, int mask, unsigned int flags)
int gfs2_permission(struct inode *inode, int mask)
{
struct gfs2_inode *ip;
struct gfs2_holder i_gh;
Expand All @@ -1553,7 +1553,7 @@ int gfs2_permission(struct inode *inode, int mask, unsigned int flags)

ip = GFS2_I(inode);
if (gfs2_glock_is_locked_by_me(ip->i_gl) == NULL) {
if (flags & IPERM_FLAG_RCU)
if (mask & MAY_NOT_BLOCK)
return -ECHILD;
error = gfs2_glock_nq_init(ip->i_gl, LM_ST_SHARED, LM_FLAG_ANY, &i_gh);
if (error)
Expand Down
2 changes: 1 addition & 1 deletion fs/gfs2/inode.h
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ extern int gfs2_inode_refresh(struct gfs2_inode *ip);

extern struct inode *gfs2_lookupi(struct inode *dir, const struct qstr *name,
int is_root);
extern int gfs2_permission(struct inode *inode, int mask, unsigned int flags);
extern int gfs2_permission(struct inode *inode, int mask);
extern int gfs2_setattr_simple(struct gfs2_inode *ip, struct iattr *attr);
extern struct inode *gfs2_lookup_simple(struct inode *dip, const char *name);
extern void gfs2_dinode_out(const struct gfs2_inode *ip, void *buf);
Expand Down
4 changes: 2 additions & 2 deletions fs/hostfs/hostfs_kern.c
Original file line number Diff line number Diff line change
Expand Up @@ -748,12 +748,12 @@ int hostfs_rename(struct inode *from_ino, struct dentry *from,
return err;
}

int hostfs_permission(struct inode *ino, int desired, unsigned int flags)
int hostfs_permission(struct inode *ino, int desired)
{
char *name;
int r = 0, w = 0, x = 0, err;

if (flags & IPERM_FLAG_RCU)
if (desired & MAY_NOT_BLOCK)
return -ECHILD;

if (desired & MAY_READ) r = 1;
Expand Down
4 changes: 2 additions & 2 deletions fs/namei.c
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ int inode_permission(struct inode *inode, int mask)
}

if (inode->i_op->permission)
retval = inode->i_op->permission(inode, mask, 0);
retval = inode->i_op->permission(inode, mask);
else
retval = generic_permission(inode, mask);

Expand Down Expand Up @@ -323,7 +323,7 @@ static inline int exec_permission(struct inode *inode, unsigned int flags)
mask |= MAY_NOT_BLOCK;

if (inode->i_op->permission) {
ret = inode->i_op->permission(inode, mask, flags);
ret = inode->i_op->permission(inode, mask);
if (likely(!ret))
goto ok;
} else {
Expand Down
4 changes: 2 additions & 2 deletions fs/nfs/dir.c
Original file line number Diff line number Diff line change
Expand Up @@ -2273,12 +2273,12 @@ int nfs_may_open(struct inode *inode, struct rpc_cred *cred, int openflags)
return nfs_do_access(inode, cred, nfs_open_permission_mask(openflags));
}

int nfs_permission(struct inode *inode, int mask, unsigned int flags)
int nfs_permission(struct inode *inode, int mask)
{
struct rpc_cred *cred;
int res = 0;

if (flags & IPERM_FLAG_RCU)
if (mask & MAY_NOT_BLOCK)
return -ECHILD;

nfs_inc_stats(inode, NFSIOS_VFSACCESS);
Expand Down
2 changes: 1 addition & 1 deletion fs/nilfs2/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -799,7 +799,7 @@ int nilfs_setattr(struct dentry *dentry, struct iattr *iattr)
return err;
}

int nilfs_permission(struct inode *inode, int mask, unsigned int flags)
int nilfs_permission(struct inode *inode, int mask)
{
struct nilfs_root *root = NILFS_I(inode)->i_root;
if ((mask & MAY_WRITE) && root &&
Expand Down
2 changes: 1 addition & 1 deletion fs/nilfs2/nilfs.h
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ extern void nilfs_update_inode(struct inode *, struct buffer_head *);
extern void nilfs_truncate(struct inode *);
extern void nilfs_evict_inode(struct inode *);
extern int nilfs_setattr(struct dentry *, struct iattr *);
int nilfs_permission(struct inode *inode, int mask, unsigned int flags);
int nilfs_permission(struct inode *inode, int mask);
int nilfs_load_inode_block(struct inode *inode, struct buffer_head **pbh);
extern int nilfs_inode_dirty(struct inode *);
int nilfs_set_file_dirty(struct inode *inode, unsigned nr_dirty);
Expand Down
4 changes: 2 additions & 2 deletions fs/ocfs2/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -1279,11 +1279,11 @@ int ocfs2_getattr(struct vfsmount *mnt,
return err;
}

int ocfs2_permission(struct inode *inode, int mask, unsigned int flags)
int ocfs2_permission(struct inode *inode, int mask)
{
int ret;

if (flags & IPERM_FLAG_RCU)
if (mask & MAY_NOT_BLOCK)
return -ECHILD;

ret = ocfs2_inode_lock(inode, NULL, 0);
Expand Down
2 changes: 1 addition & 1 deletion fs/ocfs2/file.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ int ocfs2_zero_extend(struct inode *inode, struct buffer_head *di_bh,
int ocfs2_setattr(struct dentry *dentry, struct iattr *attr);
int ocfs2_getattr(struct vfsmount *mnt, struct dentry *dentry,
struct kstat *stat);
int ocfs2_permission(struct inode *inode, int mask, unsigned int flags);
int ocfs2_permission(struct inode *inode, int mask);

int ocfs2_should_update_atime(struct inode *inode,
struct vfsmount *vfsmnt);
Expand Down
2 changes: 1 addition & 1 deletion fs/proc/base.c
Original file line number Diff line number Diff line change
Expand Up @@ -2167,7 +2167,7 @@ static const struct file_operations proc_fd_operations = {
* /proc/pid/fd needs a special permission handler so that a process can still
* access /proc/self/fd after it has executed a setuid().
*/
static int proc_fd_permission(struct inode *inode, int mask, unsigned int flags)
static int proc_fd_permission(struct inode *inode, int mask)
{
int rv = generic_permission(inode, mask);
if (rv == 0)
Expand Down
Loading

0 comments on commit 10556cb

Please sign in to comment.