patch-2.2.11 linux/fs/ext2/ioctl.c

Next file: linux/fs/ext2/super.c
Previous file: linux/fs/ext2/inode.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.10/linux/fs/ext2/ioctl.c linux/fs/ext2/ioctl.c
@@ -33,18 +33,17 @@
 		flags = flags & EXT2_FL_USER_MODIFIABLE;
 		/*
 		 * The IMMUTABLE and APPEND_ONLY flags can only be changed by
-		 * the super user when the security level is zero.
+		 * a process with the relevent capability.
 		 */
 		if ((flags & (EXT2_APPEND_FL | EXT2_IMMUTABLE_FL)) ^
 		    (inode->u.ext2_i.i_flags &
-		     (EXT2_APPEND_FL | EXT2_IMMUTABLE_FL))) {
+		     (EXT2_APPEND_FL | EXT2_IMMUTABLE_FL)))
 			/* This test looks nicer. Thanks to Pauline Middelink */
 			if (!capable(CAP_LINUX_IMMUTABLE))
 				return -EPERM;
-		} else
-			if ((current->fsuid != inode->i_uid) && 
-			    !capable(CAP_FOWNER))
-				return -EPERM;
+
+		if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))
+			return -EPERM;
 		if (IS_RDONLY(inode))
 			return -EROFS;
 		inode->u.ext2_i.i_flags = (inode->u.ext2_i.i_flags &

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)