hc
2024-05-10 9999e48639b3cecb08ffb37358bcba3b48161b29
kernel/fs/jfs/ioctl.c
....@@ -98,24 +98,16 @@
9898 /* Lock against other parallel changes of flags */
9999 inode_lock(inode);
100100
101
- oldflags = jfs_inode->mode2;
102
-
103
- /*
104
- * The IMMUTABLE and APPEND_ONLY flags can only be changed by
105
- * the relevant capability.
106
- */
107
- if ((oldflags & JFS_IMMUTABLE_FL) ||
108
- ((flags ^ oldflags) &
109
- (JFS_APPEND_FL | JFS_IMMUTABLE_FL))) {
110
- if (!capable(CAP_LINUX_IMMUTABLE)) {
111
- inode_unlock(inode);
112
- err = -EPERM;
113
- goto setflags_out;
114
- }
101
+ oldflags = jfs_map_ext2(jfs_inode->mode2 & JFS_FL_USER_VISIBLE,
102
+ 0);
103
+ err = vfs_ioc_setflags_prepare(inode, oldflags, flags);
104
+ if (err) {
105
+ inode_unlock(inode);
106
+ goto setflags_out;
115107 }
116108
117109 flags = flags & JFS_FL_USER_MODIFIABLE;
118
- flags |= oldflags & ~JFS_FL_USER_MODIFIABLE;
110
+ flags |= jfs_inode->mode2 & ~JFS_FL_USER_MODIFIABLE;
119111 jfs_inode->mode2 = flags;
120112
121113 jfs_set_inode_flags(inode);