--- linux-2.4.25-vs1.26/fs/ext2/ioctl.c 2004-05-17 11:15:14.000000000 -0400 +++ linux-2.4.25-vs1.26-attr/fs/ext2/ioctl.c 2004-05-17 10:33:23.000000000 -0400 @@ -38,6 +38,10 @@ int ext2_ioctl (struct inode * inode, st oldflags = inode->u.ext2_i.i_flags; + if (oldflags & EXT2_IMMUTABLE_LINK_FL) + /* Immutable files cannot be changed */ + if (oldflags & flags & EXT2_IMMUTABLE_FILE_FL) + return -EPERM; /* * The IMMUTABLE_* and APPEND_ONLY flags can only be changed * by the relevant capability. --- linux-2.4.25-vs1.26/fs/ext3/ioctl.c 2004-05-17 11:15:14.000000000 -0400 +++ linux-2.4.25-vs1.26-attr/fs/ext3/ioctl.c 2004-05-17 10:39:41.000000000 -0400 @@ -44,8 +44,10 @@ int ext3_ioctl (struct inode * inode, st oldflags = inode->u.ext3_i.i_flags; - /* The JOURNAL_DATA flag is modifiable only by root */ - jflag = flags & EXT3_JOURNAL_DATA_FL; + if (oldflags & EXT3_IMMUTABLE_LINK_FL) + /* Immutable files cannot be changed */ + if (oldflags & flags & EXT3_IMMUTABLE_FILE_FL) + return -EPERM; /* * The IMMUTABLE_* and APPEND_ONLY flags can only be changed @@ -58,6 +60,9 @@ int ext3_ioctl (struct inode * inode, st return -EPERM; } + /* The JOURNAL_DATA flag is modifiable only by root */ + jflag = flags & EXT3_JOURNAL_DATA_FL; + /* * The JOURNAL_DATA flag can only be changed by * the relevant capability. --- linux-2.4.25-vs1.26/fs/reiserfs/ioctl.c 2004-05-17 11:15:14.000000000 -0400 +++ linux-2.4.25-vs1.26-attr/fs/reiserfs/ioctl.c 2004-05-17 10:39:37.000000000 -0400 @@ -51,6 +51,11 @@ int reiserfs_ioctl (struct inode * inode if (get_user(flags, (int *) arg)) return -EFAULT; + if ( inode->u.reiserfs_i.i_attrs & REISERFS_IMMUTABLE_LINK_FL ) + /* Immutable files cannot be changed */ + if ( flags & inode->u.reiserfs_i.i_attrs & REISERFS_IMMUTABLE_FILE_FL ) + return -EPERM; + if ( ( ( flags ^ inode->u.reiserfs_i.i_attrs) & ( REISERFS_IMMUTABLE_FILE_FL | REISERFS_IMMUTABLE_LINK_FL | REISERFS_APPEND_FL )) && !capable( CAP_LINUX_IMMUTABLE ) )