diff options
Diffstat (limited to 'fs/xfs/xfs_attr.c')
-rw-r--r-- | fs/xfs/xfs_attr.c | 32 |
1 files changed, 6 insertions, 26 deletions
diff --git a/fs/xfs/xfs_attr.c b/fs/xfs/xfs_attr.c index 5484eeb460c8..e5e91e9c7e89 100644 --- a/fs/xfs/xfs_attr.c +++ b/fs/xfs/xfs_attr.c | |||
@@ -15,6 +15,9 @@ | |||
15 | * along with this program; if not, write the Free Software Foundation, | 15 | * along with this program; if not, write the Free Software Foundation, |
16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 16 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
17 | */ | 17 | */ |
18 | |||
19 | #include <linux/capability.h> | ||
20 | |||
18 | #include "xfs.h" | 21 | #include "xfs.h" |
19 | #include "xfs_fs.h" | 22 | #include "xfs_fs.h" |
20 | #include "xfs_types.h" | 23 | #include "xfs_types.h" |
@@ -117,11 +120,6 @@ xfs_attr_fetch(xfs_inode_t *ip, const char *name, int namelen, | |||
117 | ip->i_d.di_anextents == 0)) | 120 | ip->i_d.di_anextents == 0)) |
118 | return(ENOATTR); | 121 | return(ENOATTR); |
119 | 122 | ||
120 | if (!(flags & (ATTR_KERNACCESS|ATTR_SECURE))) { | ||
121 | if ((error = xfs_iaccess(ip, S_IRUSR, cred))) | ||
122 | return(XFS_ERROR(error)); | ||
123 | } | ||
124 | |||
125 | /* | 123 | /* |
126 | * Fill in the arg structure for this request. | 124 | * Fill in the arg structure for this request. |
127 | */ | 125 | */ |
@@ -425,7 +423,7 @@ xfs_attr_set(bhv_desc_t *bdp, const char *name, char *value, int valuelen, int f | |||
425 | struct cred *cred) | 423 | struct cred *cred) |
426 | { | 424 | { |
427 | xfs_inode_t *dp; | 425 | xfs_inode_t *dp; |
428 | int namelen, error; | 426 | int namelen; |
429 | 427 | ||
430 | namelen = strlen(name); | 428 | namelen = strlen(name); |
431 | if (namelen >= MAXNAMELEN) | 429 | if (namelen >= MAXNAMELEN) |
@@ -437,14 +435,6 @@ xfs_attr_set(bhv_desc_t *bdp, const char *name, char *value, int valuelen, int f | |||
437 | if (XFS_FORCED_SHUTDOWN(dp->i_mount)) | 435 | if (XFS_FORCED_SHUTDOWN(dp->i_mount)) |
438 | return (EIO); | 436 | return (EIO); |
439 | 437 | ||
440 | xfs_ilock(dp, XFS_ILOCK_SHARED); | ||
441 | if (!(flags & ATTR_SECURE) && | ||
442 | (error = xfs_iaccess(dp, S_IWUSR, cred))) { | ||
443 | xfs_iunlock(dp, XFS_ILOCK_SHARED); | ||
444 | return(XFS_ERROR(error)); | ||
445 | } | ||
446 | xfs_iunlock(dp, XFS_ILOCK_SHARED); | ||
447 | |||
448 | return xfs_attr_set_int(dp, name, namelen, value, valuelen, flags); | 438 | return xfs_attr_set_int(dp, name, namelen, value, valuelen, flags); |
449 | } | 439 | } |
450 | 440 | ||
@@ -579,7 +569,7 @@ int | |||
579 | xfs_attr_remove(bhv_desc_t *bdp, const char *name, int flags, struct cred *cred) | 569 | xfs_attr_remove(bhv_desc_t *bdp, const char *name, int flags, struct cred *cred) |
580 | { | 570 | { |
581 | xfs_inode_t *dp; | 571 | xfs_inode_t *dp; |
582 | int namelen, error; | 572 | int namelen; |
583 | 573 | ||
584 | namelen = strlen(name); | 574 | namelen = strlen(name); |
585 | if (namelen >= MAXNAMELEN) | 575 | if (namelen >= MAXNAMELEN) |
@@ -592,11 +582,7 @@ xfs_attr_remove(bhv_desc_t *bdp, const char *name, int flags, struct cred *cred) | |||
592 | return (EIO); | 582 | return (EIO); |
593 | 583 | ||
594 | xfs_ilock(dp, XFS_ILOCK_SHARED); | 584 | xfs_ilock(dp, XFS_ILOCK_SHARED); |
595 | if (!(flags & ATTR_SECURE) && | 585 | if (XFS_IFORK_Q(dp) == 0 || |
596 | (error = xfs_iaccess(dp, S_IWUSR, cred))) { | ||
597 | xfs_iunlock(dp, XFS_ILOCK_SHARED); | ||
598 | return(XFS_ERROR(error)); | ||
599 | } else if (XFS_IFORK_Q(dp) == 0 || | ||
600 | (dp->i_d.di_aformat == XFS_DINODE_FMT_EXTENTS && | 586 | (dp->i_d.di_aformat == XFS_DINODE_FMT_EXTENTS && |
601 | dp->i_d.di_anextents == 0)) { | 587 | dp->i_d.di_anextents == 0)) { |
602 | xfs_iunlock(dp, XFS_ILOCK_SHARED); | 588 | xfs_iunlock(dp, XFS_ILOCK_SHARED); |
@@ -668,12 +654,6 @@ xfs_attr_list(bhv_desc_t *bdp, char *buffer, int bufsize, int flags, | |||
668 | return (EIO); | 654 | return (EIO); |
669 | 655 | ||
670 | xfs_ilock(dp, XFS_ILOCK_SHARED); | 656 | xfs_ilock(dp, XFS_ILOCK_SHARED); |
671 | if (!(flags & ATTR_SECURE) && | ||
672 | (error = xfs_iaccess(dp, S_IRUSR, cred))) { | ||
673 | xfs_iunlock(dp, XFS_ILOCK_SHARED); | ||
674 | return(XFS_ERROR(error)); | ||
675 | } | ||
676 | |||
677 | /* | 657 | /* |
678 | * Decide on what work routines to call based on the inode size. | 658 | * Decide on what work routines to call based on the inode size. |
679 | */ | 659 | */ |