aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fs/afs/security.c2
-rw-r--r--fs/btrfs/inode.c7
-rw-r--r--fs/ceph/inode.c2
-rw-r--r--fs/cifs/cifsfs.c2
-rw-r--r--fs/fuse/dir.c4
-rw-r--r--fs/gfs2/inode.c5
-rw-r--r--fs/hostfs/hostfs_kern.c2
-rw-r--r--fs/hpfs/namei.c2
-rw-r--r--fs/namei.c17
-rw-r--r--fs/nfs/dir.c2
-rw-r--r--fs/nilfs2/inode.c2
-rw-r--r--fs/ocfs2/file.c4
-rw-r--r--fs/ocfs2/namei.c1
-rw-r--r--fs/proc/base.c2
-rw-r--r--fs/reiserfs/file.c1
-rw-r--r--fs/reiserfs/namei.c4
-rw-r--r--fs/reiserfs/xattr.c18
-rw-r--r--fs/sysfs/inode.c2
-rw-r--r--include/linux/fs.h3
-rw-r--r--include/linux/reiserfs_xattr.h2
20 files changed, 47 insertions, 37 deletions
diff --git a/fs/afs/security.c b/fs/afs/security.c
index f44b9d355377..745ee654165f 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, NULL); 353 ret = generic_permission(inode, mask, flags);
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 3601f0aebddf..f0bd87371566 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, btrfs_check_acl); 7342 return generic_permission(inode, mask, flags);
7343} 7343}
7344 7344
7345static const struct inode_operations btrfs_dir_inode_operations = { 7345static const struct inode_operations btrfs_dir_inode_operations = {
@@ -7359,10 +7359,12 @@ static const struct inode_operations btrfs_dir_inode_operations = {
7359 .listxattr = btrfs_listxattr, 7359 .listxattr = btrfs_listxattr,
7360 .removexattr = btrfs_removexattr, 7360 .removexattr = btrfs_removexattr,
7361 .permission = btrfs_permission, 7361 .permission = btrfs_permission,
7362 .check_acl = btrfs_check_acl,
7362}; 7363};
7363static const struct inode_operations btrfs_dir_ro_inode_operations = { 7364static const struct inode_operations btrfs_dir_ro_inode_operations = {
7364 .lookup = btrfs_lookup, 7365 .lookup = btrfs_lookup,
7365 .permission = btrfs_permission, 7366 .permission = btrfs_permission,
7367 .check_acl = btrfs_check_acl,
7366}; 7368};
7367 7369
7368static const struct file_operations btrfs_dir_file_operations = { 7370static const struct file_operations btrfs_dir_file_operations = {
@@ -7431,6 +7433,7 @@ static const struct inode_operations btrfs_file_inode_operations = {
7431 .removexattr = btrfs_removexattr, 7433 .removexattr = btrfs_removexattr,
7432 .permission = btrfs_permission, 7434 .permission = btrfs_permission,
7433 .fiemap = btrfs_fiemap, 7435 .fiemap = btrfs_fiemap,
7436 .check_acl = btrfs_check_acl,
7434}; 7437};
7435static const struct inode_operations btrfs_special_inode_operations = { 7438static const struct inode_operations btrfs_special_inode_operations = {
7436 .getattr = btrfs_getattr, 7439 .getattr = btrfs_getattr,
@@ -7440,6 +7443,7 @@ static const struct inode_operations btrfs_special_inode_operations = {
7440 .getxattr = btrfs_getxattr, 7443 .getxattr = btrfs_getxattr,
7441 .listxattr = btrfs_listxattr, 7444 .listxattr = btrfs_listxattr,
7442 .removexattr = btrfs_removexattr, 7445 .removexattr = btrfs_removexattr,
7446 .check_acl = btrfs_check_acl,
7443}; 7447};
7444static const struct inode_operations btrfs_symlink_inode_operations = { 7448static const struct inode_operations btrfs_symlink_inode_operations = {
7445 .readlink = generic_readlink, 7449 .readlink = generic_readlink,
@@ -7451,6 +7455,7 @@ static const struct inode_operations btrfs_symlink_inode_operations = {
7451 .getxattr = btrfs_getxattr, 7455 .getxattr = btrfs_getxattr,
7452 .listxattr = btrfs_listxattr, 7456 .listxattr = btrfs_listxattr,
7453 .removexattr = btrfs_removexattr, 7457 .removexattr = btrfs_removexattr,
7458 .check_acl = btrfs_check_acl,
7454}; 7459};
7455 7460
7456const struct dentry_operations btrfs_dentry_operations = { 7461const struct dentry_operations btrfs_dentry_operations = {
diff --git a/fs/ceph/inode.c b/fs/ceph/inode.c
index d8858e96ab18..beb5d55d6fd2 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, NULL); 1808 err = generic_permission(inode, mask, flags);
1809 return err; 1809 return err;
1810} 1810}
1811 1811
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index bc4b12ca537b..b79804fa410f 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, NULL); 242 return generic_permission(inode, mask, flags);
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 d50160714595..0a2fcd860ad6 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, NULL); 1021 err = generic_permission(inode, mask, flags);
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
@@ -1027,7 +1027,7 @@ static int fuse_permission(struct inode *inode, int mask, unsigned int flags)
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, NULL); 1030 flags);
1031 } 1031 }
1032 1032
1033 /* Note: the opposite of the above test does not 1033 /* Note: the opposite of the above test does not
diff --git a/fs/gfs2/inode.c b/fs/gfs2/inode.c
index 03e0c529063e..d5f0f4ea25dc 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, gfs2_check_acl); 1567 error = generic_permission(inode, mask, flags);
1568 if (unlock) 1568 if (unlock)
1569 gfs2_glock_dq_uninit(&i_gh); 1569 gfs2_glock_dq_uninit(&i_gh);
1570 1570
@@ -1854,6 +1854,7 @@ const struct inode_operations gfs2_file_iops = {
1854 .listxattr = gfs2_listxattr, 1854 .listxattr = gfs2_listxattr,
1855 .removexattr = gfs2_removexattr, 1855 .removexattr = gfs2_removexattr,
1856 .fiemap = gfs2_fiemap, 1856 .fiemap = gfs2_fiemap,
1857 .check_acl = gfs2_check_acl,
1857}; 1858};
1858 1859
1859const struct inode_operations gfs2_dir_iops = { 1860const struct inode_operations gfs2_dir_iops = {
@@ -1874,6 +1875,7 @@ const struct inode_operations gfs2_dir_iops = {
1874 .listxattr = gfs2_listxattr, 1875 .listxattr = gfs2_listxattr,
1875 .removexattr = gfs2_removexattr, 1876 .removexattr = gfs2_removexattr,
1876 .fiemap = gfs2_fiemap, 1877 .fiemap = gfs2_fiemap,
1878 .check_acl = gfs2_check_acl,
1877}; 1879};
1878 1880
1879const struct inode_operations gfs2_symlink_iops = { 1881const struct inode_operations gfs2_symlink_iops = {
@@ -1888,5 +1890,6 @@ const struct inode_operations gfs2_symlink_iops = {
1888 .listxattr = gfs2_listxattr, 1890 .listxattr = gfs2_listxattr,
1889 .removexattr = gfs2_removexattr, 1891 .removexattr = gfs2_removexattr,
1890 .fiemap = gfs2_fiemap, 1892 .fiemap = gfs2_fiemap,
1893 .check_acl = gfs2_check_acl,
1891}; 1894};
1892 1895
diff --git a/fs/hostfs/hostfs_kern.c b/fs/hostfs/hostfs_kern.c
index 2638c834ed28..a98d0d1aef65 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, NULL); 773 err = generic_permission(ino, desired, flags);
774 return err; 774 return err;
775} 775}
776 776
diff --git a/fs/hpfs/namei.c b/fs/hpfs/namei.c
index acf95dab2aac..bd2ce7dd8df3 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, NULL) || 401 if (generic_permission(inode, MAY_WRITE, 0) ||
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 d286cbc3f3e5..c5af0f37e67d 100644
--- a/fs/namei.c
+++ b/fs/namei.c
@@ -176,9 +176,9 @@ EXPORT_SYMBOL(putname);
176/* 176/*
177 * This does basic POSIX ACL permission checking 177 * This does basic POSIX ACL permission checking
178 */ 178 */
179static int acl_permission_check(struct inode *inode, int mask, unsigned int flags, 179static int acl_permission_check(struct inode *inode, int mask, unsigned int flags)
180 int (*check_acl)(struct inode *inode, int mask, unsigned int flags))
181{ 180{
181 int (*check_acl)(struct inode *inode, int mask, unsigned int flags);
182 unsigned int mode = inode->i_mode; 182 unsigned int mode = inode->i_mode;
183 183
184 mask &= MAY_READ | MAY_WRITE | MAY_EXEC; 184 mask &= MAY_READ | MAY_WRITE | MAY_EXEC;
@@ -189,6 +189,7 @@ static int acl_permission_check(struct inode *inode, int mask, unsigned int flag
189 if (current_fsuid() == inode->i_uid) 189 if (current_fsuid() == inode->i_uid)
190 mode >>= 6; 190 mode >>= 6;
191 else { 191 else {
192 check_acl = inode->i_op->check_acl;
192 if (IS_POSIXACL(inode) && (mode & S_IRWXG) && check_acl) { 193 if (IS_POSIXACL(inode) && (mode & S_IRWXG) && check_acl) {
193 int error = check_acl(inode, mask, flags); 194 int error = check_acl(inode, mask, flags);
194 if (error != -EAGAIN) 195 if (error != -EAGAIN)
@@ -212,7 +213,6 @@ other_perms:
212 * generic_permission - check for access rights on a Posix-like filesystem 213 * generic_permission - check for access rights on a Posix-like filesystem
213 * @inode: inode to check access rights for 214 * @inode: inode to check access rights for
214 * @mask: right to check for (%MAY_READ, %MAY_WRITE, %MAY_EXEC) 215 * @mask: right to check for (%MAY_READ, %MAY_WRITE, %MAY_EXEC)
215 * @check_acl: optional callback to check for Posix ACLs
216 * @flags: IPERM_FLAG_ flags. 216 * @flags: IPERM_FLAG_ flags.
217 * 217 *
218 * Used to check for read/write/execute permissions on a file. 218 * Used to check for read/write/execute permissions on a file.
@@ -224,15 +224,14 @@ 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, unsigned int flags)
228 int (*check_acl)(struct inode *inode, int mask, unsigned int flags))
229{ 228{
230 int ret; 229 int ret;
231 230
232 /* 231 /*
233 * Do the basic POSIX ACL permission checks. 232 * Do the basic POSIX ACL permission checks.
234 */ 233 */
235 ret = acl_permission_check(inode, mask, flags, check_acl); 234 ret = acl_permission_check(inode, mask, flags);
236 if (ret != -EACCES) 235 if (ret != -EACCES)
237 return ret; 236 return ret;
238 237
@@ -290,8 +289,7 @@ int inode_permission(struct inode *inode, int mask)
290 if (inode->i_op->permission) 289 if (inode->i_op->permission)
291 retval = inode->i_op->permission(inode, mask, 0); 290 retval = inode->i_op->permission(inode, mask, 0);
292 else 291 else
293 retval = generic_permission(inode, mask, 0, 292 retval = generic_permission(inode, mask, 0);
294 inode->i_op->check_acl);
295 293
296 if (retval) 294 if (retval)
297 return retval; 295 return retval;
@@ -326,8 +324,7 @@ static inline int exec_permission(struct inode *inode, unsigned int flags)
326 if (likely(!ret)) 324 if (likely(!ret))
327 goto ok; 325 goto ok;
328 } else { 326 } else {
329 ret = acl_permission_check(inode, MAY_EXEC, flags, 327 ret = acl_permission_check(inode, MAY_EXEC, flags);
330 inode->i_op->check_acl);
331 if (likely(!ret)) 328 if (likely(!ret))
332 goto ok; 329 goto ok;
333 if (ret != -EACCES) 330 if (ret != -EACCES)
diff --git a/fs/nfs/dir.c b/fs/nfs/dir.c
index ededdbd0db38..0485dca34fb1 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, NULL); 2331 res = generic_permission(inode, mask, flags);
2332 goto out; 2332 goto out;
2333} 2333}
2334 2334
diff --git a/fs/nilfs2/inode.c b/fs/nilfs2/inode.c
index b9b45fc2903e..650aa7755003 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, NULL); 809 return generic_permission(inode, mask, flags);
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 b1e35a392ca5..d058cb7e12d4 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, ocfs2_check_acl); 1296 ret = generic_permission(inode, mask, flags);
1297 1297
1298 ocfs2_inode_unlock(inode, 0); 1298 ocfs2_inode_unlock(inode, 0);
1299out: 1299out:
@@ -2593,12 +2593,14 @@ const struct inode_operations ocfs2_file_iops = {
2593 .listxattr = ocfs2_listxattr, 2593 .listxattr = ocfs2_listxattr,
2594 .removexattr = generic_removexattr, 2594 .removexattr = generic_removexattr,
2595 .fiemap = ocfs2_fiemap, 2595 .fiemap = ocfs2_fiemap,
2596 .check_acl = ocfs2_check_acl,
2596}; 2597};
2597 2598
2598const struct inode_operations ocfs2_special_file_iops = { 2599const struct inode_operations ocfs2_special_file_iops = {
2599 .setattr = ocfs2_setattr, 2600 .setattr = ocfs2_setattr,
2600 .getattr = ocfs2_getattr, 2601 .getattr = ocfs2_getattr,
2601 .permission = ocfs2_permission, 2602 .permission = ocfs2_permission,
2603 .check_acl = ocfs2_check_acl,
2602}; 2604};
2603 2605
2604/* 2606/*
diff --git a/fs/ocfs2/namei.c b/fs/ocfs2/namei.c
index e5d738cd9cc0..33889dc52dd7 100644
--- a/fs/ocfs2/namei.c
+++ b/fs/ocfs2/namei.c
@@ -2498,4 +2498,5 @@ const struct inode_operations ocfs2_dir_iops = {
2498 .listxattr = ocfs2_listxattr, 2498 .listxattr = ocfs2_listxattr,
2499 .removexattr = generic_removexattr, 2499 .removexattr = generic_removexattr,
2500 .fiemap = ocfs2_fiemap, 2500 .fiemap = ocfs2_fiemap,
2501 .check_acl = ocfs2_check_acl,
2501}; 2502};
diff --git a/fs/proc/base.c b/fs/proc/base.c
index fc5bc2767692..8b8470113576 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, NULL); 2172 int rv = generic_permission(inode, mask, flags);
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/file.c b/fs/reiserfs/file.c
index 91f080cc76c8..bbf31003d308 100644
--- a/fs/reiserfs/file.c
+++ b/fs/reiserfs/file.c
@@ -312,4 +312,5 @@ const struct inode_operations reiserfs_file_inode_operations = {
312 .listxattr = reiserfs_listxattr, 312 .listxattr = reiserfs_listxattr,
313 .removexattr = reiserfs_removexattr, 313 .removexattr = reiserfs_removexattr,
314 .permission = reiserfs_permission, 314 .permission = reiserfs_permission,
315 .check_acl = reiserfs_check_acl,
315}; 316};
diff --git a/fs/reiserfs/namei.c b/fs/reiserfs/namei.c
index 118662690cdf..551f1b79dbc4 100644
--- a/fs/reiserfs/namei.c
+++ b/fs/reiserfs/namei.c
@@ -1529,6 +1529,7 @@ const struct inode_operations reiserfs_dir_inode_operations = {
1529 .listxattr = reiserfs_listxattr, 1529 .listxattr = reiserfs_listxattr,
1530 .removexattr = reiserfs_removexattr, 1530 .removexattr = reiserfs_removexattr,
1531 .permission = reiserfs_permission, 1531 .permission = reiserfs_permission,
1532 .check_acl = reiserfs_check_acl,
1532}; 1533};
1533 1534
1534/* 1535/*
@@ -1545,6 +1546,7 @@ const struct inode_operations reiserfs_symlink_inode_operations = {
1545 .listxattr = reiserfs_listxattr, 1546 .listxattr = reiserfs_listxattr,
1546 .removexattr = reiserfs_removexattr, 1547 .removexattr = reiserfs_removexattr,
1547 .permission = reiserfs_permission, 1548 .permission = reiserfs_permission,
1549 .check_acl = reiserfs_check_acl,
1548 1550
1549}; 1551};
1550 1552
@@ -1558,5 +1560,5 @@ const struct inode_operations reiserfs_special_inode_operations = {
1558 .listxattr = reiserfs_listxattr, 1560 .listxattr = reiserfs_listxattr,
1559 .removexattr = reiserfs_removexattr, 1561 .removexattr = reiserfs_removexattr,
1560 .permission = reiserfs_permission, 1562 .permission = reiserfs_permission,
1561 1563 .check_acl = reiserfs_check_acl,
1562}; 1564};
diff --git a/fs/reiserfs/xattr.c b/fs/reiserfs/xattr.c
index d78089690965..ddc5301d2986 100644
--- a/fs/reiserfs/xattr.c
+++ b/fs/reiserfs/xattr.c
@@ -868,11 +868,17 @@ out:
868 return err; 868 return err;
869} 869}
870 870
871static int reiserfs_check_acl(struct inode *inode, int mask, unsigned int flags) 871int reiserfs_check_acl(struct inode *inode, int mask, unsigned int flags)
872{ 872{
873 struct posix_acl *acl; 873 struct posix_acl *acl;
874 int error = -EAGAIN; /* do regular unix permission checks by default */ 874 int error = -EAGAIN; /* do regular unix permission checks by default */
875 875
876 /*
877 * Stat data v1 doesn't support ACLs.
878 */
879 if (get_inode_sd_version(inode) == STAT_DATA_V1)
880 return -EAGAIN;
881
876 if (flags & IPERM_FLAG_RCU) 882 if (flags & IPERM_FLAG_RCU)
877 return -ECHILD; 883 return -ECHILD;
878 884
@@ -961,15 +967,7 @@ int reiserfs_permission(struct inode *inode, int mask, unsigned int flags)
961 if (IS_PRIVATE(inode)) 967 if (IS_PRIVATE(inode))
962 return 0; 968 return 0;
963 969
964#ifdef CONFIG_REISERFS_FS_XATTR 970 return generic_permission(inode, mask, flags);
965 /*
966 * Stat data v1 doesn't support ACLs.
967 */
968 if (get_inode_sd_version(inode) != STAT_DATA_V1)
969 return generic_permission(inode, mask, flags,
970 reiserfs_check_acl);
971#endif
972 return generic_permission(inode, mask, flags, NULL);
973} 971}
974 972
975static 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 0a12eb89cd32..a37165c64757 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, NULL); 365 return generic_permission(inode, mask, flags);
366} 366}
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 8c84ed930389..0c15d5e459d5 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -2187,8 +2187,7 @@ extern sector_t bmap(struct inode *, sector_t);
2187#endif 2187#endif
2188extern int notify_change(struct dentry *, struct iattr *); 2188extern int notify_change(struct dentry *, struct iattr *);
2189extern int inode_permission(struct inode *, int); 2189extern int inode_permission(struct inode *, int);
2190extern int generic_permission(struct inode *, int, unsigned int, 2190extern int generic_permission(struct inode *, int, unsigned int);
2191 int (*check_acl)(struct inode *, int, unsigned int));
2192 2191
2193static inline bool execute_ok(struct inode *inode) 2192static inline bool execute_ok(struct inode *inode)
2194{ 2193{
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h
index 6deef5dc95fb..1a3ca8f80200 100644
--- a/include/linux/reiserfs_xattr.h
+++ b/include/linux/reiserfs_xattr.h
@@ -45,6 +45,7 @@ int reiserfs_permission(struct inode *inode, int mask, unsigned int flags);
45 45
46#ifdef CONFIG_REISERFS_FS_XATTR 46#ifdef CONFIG_REISERFS_FS_XATTR
47#define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir) 47#define has_xattr_dir(inode) (REISERFS_I(inode)->i_flags & i_has_xattr_dir)
48int reiserfs_check_acl(struct inode *inode, int mask, unsigned int flags);
48ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name, 49ssize_t reiserfs_getxattr(struct dentry *dentry, const char *name,
49 void *buffer, size_t size); 50 void *buffer, size_t size);
50int reiserfs_setxattr(struct dentry *dentry, const char *name, 51int reiserfs_setxattr(struct dentry *dentry, const char *name,
@@ -122,6 +123,7 @@ static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
122#define reiserfs_setxattr NULL 123#define reiserfs_setxattr NULL
123#define reiserfs_listxattr NULL 124#define reiserfs_listxattr NULL
124#define reiserfs_removexattr NULL 125#define reiserfs_removexattr NULL
126#define reiserfs_check_acl NULL
125 127
126static inline void reiserfs_init_xattr_rwsem(struct inode *inode) 128static inline void reiserfs_init_xattr_rwsem(struct inode *inode)
127{ 129{