All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 8/8] remove xfs xattr permission checks
@ 2005-11-01  2:31 Christoph Hellwig
  0 siblings, 0 replies; only message in thread
From: Christoph Hellwig @ 2005-11-01  2:31 UTC (permalink / raw)
  To: akpm; +Cc: linux-fsdevel

remove checks now in the VFS

XFS has an additional xattr interface through obscure ioctl.  it
requires raised capabilities but we need to add some read-only/immutable
checks anyway


Signed-off-by: Christoph Hellwig <hch@lst.de>

Index: linux-2.6/fs/xfs/xfs_attr.c
===================================================================
--- linux-2.6.orig/fs/xfs/xfs_attr.c	2005-10-31 05:02:17.000000000 +0100
+++ linux-2.6/fs/xfs/xfs_attr.c	2005-10-31 05:04:04.000000000 +0100
@@ -133,11 +133,6 @@
 	     ip->i_d.di_anextents == 0))
 		return(ENOATTR);
 
-	if (!(flags & (ATTR_KERNACCESS|ATTR_SECURE))) {
-		if ((error = xfs_iaccess(ip, S_IRUSR, cred)))
-			return(XFS_ERROR(error));
-	}
-
 	/*
 	 * Fill in the arg structure for this request.
 	 */
@@ -227,14 +222,6 @@
 	if (XFS_FORCED_SHUTDOWN(mp))
 		return (EIO);
 
-	xfs_ilock(dp, XFS_ILOCK_SHARED);
-	if (!(flags & ATTR_SECURE) &&
-	     (error = xfs_iaccess(dp, S_IWUSR, cred))) {
-		xfs_iunlock(dp, XFS_ILOCK_SHARED);
-		return(XFS_ERROR(error));
-	}
-	xfs_iunlock(dp, XFS_ILOCK_SHARED);
-
 	/*
 	 * Attach the dquots to the inode.
 	 */
@@ -485,11 +472,7 @@
 		return (EIO);
 
 	xfs_ilock(dp, XFS_ILOCK_SHARED);
-	if (!(flags & ATTR_SECURE) &&
-	     (error = xfs_iaccess(dp, S_IWUSR, cred))) {
-		xfs_iunlock(dp, XFS_ILOCK_SHARED);
-		return(XFS_ERROR(error));
-	} else if (XFS_IFORK_Q(dp) == 0 ||
+	if (XFS_IFORK_Q(dp) == 0 ||
 		   (dp->i_d.di_aformat == XFS_DINODE_FMT_EXTENTS &&
 		    dp->i_d.di_anextents == 0)) {
 		xfs_iunlock(dp, XFS_ILOCK_SHARED);
@@ -673,12 +656,6 @@
 		return (EIO);
 
 	xfs_ilock(dp, XFS_ILOCK_SHARED);
-	if (!(flags & ATTR_SECURE) &&
-	     (error = xfs_iaccess(dp, S_IRUSR, cred))) {
-		xfs_iunlock(dp, XFS_ILOCK_SHARED);
-		return(XFS_ERROR(error));
-	}
-
 	/*
 	 * Decide on what work routines to call based on the inode size.
 	 */
Index: linux-2.6/fs/xfs/linux-2.6/xfs_ioctl.c
===================================================================
--- linux-2.6.orig/fs/xfs/linux-2.6/xfs_ioctl.c	2005-09-08 13:15:28.000000000 +0200
+++ linux-2.6/fs/xfs/linux-2.6/xfs_ioctl.c	2005-10-31 05:07:05.000000000 +0100
@@ -545,6 +545,8 @@
 	char			*kbuf;
 	int			error = EFAULT;
 
+	if (IS_RDONLY(&vp->v_inode))
+		return -EROFS;
 	if (IS_IMMUTABLE(&vp->v_inode) || IS_APPEND(&vp->v_inode))
 		return EPERM;
 	if (len > XATTR_SIZE_MAX)
@@ -572,6 +574,9 @@
 {
 	int			error;
 
+
+	if (IS_RDONLY(&vp->v_inode))
+		return -EROFS;
 	if (IS_IMMUTABLE(&vp->v_inode) || IS_APPEND(&vp->v_inode))
 		return EPERM;
 

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2005-11-01  2:31 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-11-01  2:31 [PATCH 8/8] remove xfs xattr permission checks Christoph Hellwig

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.