aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-06-20 19:16:29 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2011-07-20 01:43:22 -0400
commit2830ba7f34ebb27c4e5b8b6ef408cd6d74860890 (patch)
treebbcebc14bffd000f1dfcbf37e64f56d2f49581ac /fs
parent7e40145eb111a5192e6d819f764db9d6828d1abb (diff)
->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>
Diffstat (limited to 'fs')
-rw-r--r--fs/afs/security.c2
-rw-r--r--fs/btrfs/inode.c2
-rw-r--r--fs/ceph/inode.c2
-rw-r--r--fs/cifs/cifsfs.c2
-rw-r--r--fs/fuse/dir.c5
-rw-r--r--fs/gfs2/inode.c2
-rw-r--r--fs/hostfs/hostfs_kern.c2
-rw-r--r--fs/hpfs/namei.c2
-rw-r--r--fs/namei.c4
-rw-r--r--fs/nfs/dir.c2
-rw-r--r--fs/nilfs2/inode.c2
-rw-r--r--fs/ocfs2/file.c2
-rw-r--r--fs/proc/base.c2
-rw-r--r--fs/reiserfs/xattr.c2
-rw-r--r--fs/sysfs/inode.c2
15 files changed, 17 insertions, 18 deletions
diff --git a/fs/afs/security.c b/fs/afs/security.c
index 745ee654165f..ab6b3147f05f 100644
--- a/fs/afs/security.c
+++ b/fs/afs/security.c
@@ -350,7 +350,7 @@ int afs_permission(struct inode *inode, int mask, unsigned int flags)
350 } 350 }
351 351
352 key_put(key); 352 key_put(key);
353 ret = generic_permission(inode, mask, flags); 353 ret = generic_permission(inode, mask);
354 _leave(" = %d", ret); 354 _leave(" = %d", ret);
355 return ret; 355 return ret;
356 356
diff --git a/fs/btrfs/inode.c b/fs/btrfs/inode.c
index f0bd87371566..b61b0477a8ac 100644
--- a/fs/btrfs/inode.c
+++ b/fs/btrfs/inode.c
@@ -7339,7 +7339,7 @@ static int btrfs_permission(struct inode *inode, int mask, unsigned int flags)
7339 return -EROFS; 7339 return -EROFS;
7340 if ((BTRFS_I(inode)->flags & BTRFS_INODE_READONLY) && (mask & MAY_WRITE)) 7340 if ((BTRFS_I(inode)->flags & BTRFS_INODE_READONLY) && (mask & MAY_WRITE))
7341 return -EACCES; 7341 return -EACCES;
7342 return generic_permission(inode, mask, flags); 7342 return generic_permission(inode, mask);
7343} 7343}
7344 7344
7345static const struct inode_operations btrfs_dir_inode_operations = { 7345static const struct inode_operations btrfs_dir_inode_operations = {
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index beb5d55d6fd2..9c169741b416 100644
--- a/fs/ceph/inode.c
+++ b/fs/ceph/inode.c
@@ -1805,7 +1805,7 @@ int ceph_permission(struct inode *inode, int mask, unsigned int flags)
1805 err = ceph_do_getattr(inode, CEPH_CAP_AUTH_SHARED); 1805 err = ceph_do_getattr(inode, CEPH_CAP_AUTH_SHARED);
1806 1806
1807 if (!err) 1807 if (!err)
1808 err = generic_permission(inode, mask, flags); 1808 err = generic_permission(inode, mask);
1809 return err; 1809 return err;
1810} 1810}
1811 1811
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index b79804fa410f..b285b5bcf711 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -239,7 +239,7 @@ static int cifs_permission(struct inode *inode, int mask, unsigned int flags)
239 on the client (above and beyond ACL on servers) for 239 on the client (above and beyond ACL on servers) for
240 servers which do not support setting and viewing mode bits, 240 servers which do not support setting and viewing mode bits,
241 so allowing client to check permissions is useful */ 241 so allowing client to check permissions is useful */
242 return generic_permission(inode, mask, flags); 242 return generic_permission(inode, mask);
243} 243}
244 244
245static struct kmem_cache *cifs_inode_cachep; 245static struct kmem_cache *cifs_inode_cachep;
diff --git a/fs/fuse/dir.c b/fs/fuse/dir.c
index 0a2fcd860ad6..0df56b6c26e2 100644
--- a/fs/fuse/dir.c
+++ b/fs/fuse/dir.c
@@ -1018,7 +1018,7 @@ static int fuse_permission(struct inode *inode, int mask, unsigned int flags)
1018 } 1018 }
1019 1019
1020 if (fc->flags & FUSE_DEFAULT_PERMISSIONS) { 1020 if (fc->flags & FUSE_DEFAULT_PERMISSIONS) {
1021 err = generic_permission(inode, mask, flags); 1021 err = generic_permission(inode, mask);
1022 1022
1023 /* If permission is denied, try to refresh file 1023 /* If permission is denied, try to refresh file
1024 attributes. This is also needed, because the root 1024 attributes. This is also needed, because the root
@@ -1026,8 +1026,7 @@ static int fuse_permission(struct inode *inode, int mask, unsigned int flags)
1026 if (err == -EACCES && !refreshed) { 1026 if (err == -EACCES && !refreshed) {
1027 err = fuse_perm_getattr(inode, flags); 1027 err = fuse_perm_getattr(inode, flags);
1028 if (!err) 1028 if (!err)
1029 err = generic_permission(inode, mask, 1029 err = generic_permission(inode, mask);
1030 flags);
1031 } 1030 }
1032 1031
1033 /* Note: the opposite of the above test does not 1032 /* Note: the opposite of the above test does not
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index d5f0f4ea25dc..b776ec8f9c19 100644
--- a/fs/gfs2/inode.c
+++ b/fs/gfs2/inode.c
@@ -1564,7 +1564,7 @@ int gfs2_permission(struct inode *inode, int mask, unsigned int flags)
1564 if ((mask & MAY_WRITE) && IS_IMMUTABLE(inode)) 1564 if ((mask & MAY_WRITE) && IS_IMMUTABLE(inode))
1565 error = -EACCES; 1565 error = -EACCES;
1566 else 1566 else
1567 error = generic_permission(inode, mask, flags); 1567 error = generic_permission(inode, mask);
1568 if (unlock) 1568 if (unlock)
1569 gfs2_glock_dq_uninit(&i_gh); 1569 gfs2_glock_dq_uninit(&i_gh);
1570 1570
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index a98d0d1aef65..b1bc31bde833 100644
--- a/fs/hostfs/hostfs_kern.c
+++ b/fs/hostfs/hostfs_kern.c
@@ -770,7 +770,7 @@ int hostfs_permission(struct inode *ino, int desired, unsigned int flags)
770 err = access_file(name, r, w, x); 770 err = access_file(name, r, w, x);
771 __putname(name); 771 __putname(name);
772 if (!err) 772 if (!err)
773 err = generic_permission(ino, desired, flags); 773 err = generic_permission(ino, desired);
774 return err; 774 return err;
775} 775}
776 776
diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c
index bd2ce7dd8df3..2df69e2f07cf 100644
--- a/fs/hpfs/namei.c
+++ b/fs/hpfs/namei.c
@@ -398,7 +398,7 @@ again:
398 hpfs_unlock(dir->i_sb); 398 hpfs_unlock(dir->i_sb);
399 return -ENOSPC; 399 return -ENOSPC;
400 } 400 }
401 if (generic_permission(inode, MAY_WRITE, 0) || 401 if (generic_permission(inode, MAY_WRITE) ||
402 !S_ISREG(inode->i_mode) || 402 !S_ISREG(inode->i_mode) ||
403 get_write_access(inode)) { 403 get_write_access(inode)) {
404 d_rehash(dentry); 404 d_rehash(dentry);
diff --git a/fs/namei.c b/fs/namei.c
index 560fd1dff1d0..684e0f30cf4c 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -224,7 +224,7 @@ other_perms:
224 * request cannot be satisfied (eg. requires blocking or too much complexity). 224 * request cannot be satisfied (eg. requires blocking or too much complexity).
225 * It would then be called again in ref-walk mode. 225 * It would then be called again in ref-walk mode.
226 */ 226 */
227int generic_permission(struct inode *inode, int mask, unsigned int flags) 227int generic_permission(struct inode *inode, int mask)
228{ 228{
229 int ret; 229 int ret;
230 230
@@ -289,7 +289,7 @@ int inode_permission(struct inode *inode, int mask)
289 if (inode->i_op->permission) 289 if (inode->i_op->permission)
290 retval = inode->i_op->permission(inode, mask, 0); 290 retval = inode->i_op->permission(inode, mask, 0);
291 else 291 else
292 retval = generic_permission(inode, mask, 0); 292 retval = generic_permission(inode, mask);
293 293
294 if (retval) 294 if (retval)
295 return retval; 295 return retval;
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index 0485dca34fb1..16cf84b4afb9 100644
--- a/fs/nfs/dir.c
+++ b/fs/nfs/dir.c
@@ -2328,7 +2328,7 @@ out:
2328out_notsup: 2328out_notsup:
2329 res = nfs_revalidate_inode(NFS_SERVER(inode), inode); 2329 res = nfs_revalidate_inode(NFS_SERVER(inode), inode);
2330 if (res == 0) 2330 if (res == 0)
2331 res = generic_permission(inode, mask, flags); 2331 res = generic_permission(inode, mask);
2332 goto out; 2332 goto out;
2333} 2333}
2334 2334
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
index 650aa7755003..0df6de58bbcb 100644
--- a/fs/nilfs2/inode.c
+++ b/fs/nilfs2/inode.c
@@ -806,7 +806,7 @@ int nilfs_permission(struct inode *inode, int mask, unsigned int flags)
806 root->cno != NILFS_CPTREE_CURRENT_CNO) 806 root->cno != NILFS_CPTREE_CURRENT_CNO)
807 return -EROFS; /* snapshot is not writable */ 807 return -EROFS; /* snapshot is not writable */
808 808
809 return generic_permission(inode, mask, flags); 809 return generic_permission(inode, mask);
810} 810}
811 811
812int nilfs_load_inode_block(struct inode *inode, struct buffer_head **pbh) 812int nilfs_load_inode_block(struct inode *inode, struct buffer_head **pbh)
diff --git a/fs/ocfs2/file.c b/fs/ocfs2/file.c
index d058cb7e12d4..ecb52b028964 100644
--- a/fs/ocfs2/file.c
+++ b/fs/ocfs2/file.c
@@ -1293,7 +1293,7 @@ int ocfs2_permission(struct inode *inode, int mask, unsigned int flags)
1293 goto out; 1293 goto out;
1294 } 1294 }
1295 1295
1296 ret = generic_permission(inode, mask, flags); 1296 ret = generic_permission(inode, mask);
1297 1297
1298 ocfs2_inode_unlock(inode, 0); 1298 ocfs2_inode_unlock(inode, 0);
1299out: 1299out:
diff --git a/fs/proc/base.c b/fs/proc/base.c
index 8b8470113576..53a1a961b25f 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2169,7 +2169,7 @@ static const struct file_operations proc_fd_operations = {
2169 */ 2169 */
2170static int proc_fd_permission(struct inode *inode, int mask, unsigned int flags) 2170static int proc_fd_permission(struct inode *inode, int mask, unsigned int flags)
2171{ 2171{
2172 int rv = generic_permission(inode, mask, flags); 2172 int rv = generic_permission(inode, mask);
2173 if (rv == 0) 2173 if (rv == 0)
2174 return 0; 2174 return 0;
2175 if (task_pid(current) == proc_pid(inode)) 2175 if (task_pid(current) == proc_pid(inode))
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index 6ee3c11aa8d9..f17319613a85 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -967,7 +967,7 @@ int reiserfs_permission(struct inode *inode, int mask, unsigned int flags)
967 if (IS_PRIVATE(inode)) 967 if (IS_PRIVATE(inode))
968 return 0; 968 return 0;
969 969
970 return generic_permission(inode, mask, flags); 970 return generic_permission(inode, mask);
971} 971}
972 972
973static int xattr_hide_revalidate(struct dentry *dentry, struct nameidata *nd) 973static int xattr_hide_revalidate(struct dentry *dentry, struct nameidata *nd)
diff --git a/fs/sysfs/inode.c b/fs/sysfs/inode.c
index a37165c64757..04c81e5ba6f7 100644
--- a/fs/sysfs/inode.c
+++ b/fs/sysfs/inode.c
@@ -362,5 +362,5 @@ int sysfs_permission(struct inode *inode, int mask, unsigned int flags)
362 sysfs_refresh_inode(sd, inode); 362 sysfs_refresh_inode(sd, inode);
363 mutex_unlock(&sysfs_mutex); 363 mutex_unlock(&sysfs_mutex);
364 364
365 return generic_permission(inode, mask, flags); 365 return generic_permission(inode, mask);
366} 366}