patch: ext2 flags handling

Jes Sorensen (Jes.Sorensen@cern.ch)
Fri, 3 Sep 1999 17:13:56 +0200


Hi

There is a bug in the ext2 flags handling it seems. The xor trick it
uses doesn't work since ATTR_FLAG_APPEND != EXT_APPEND_FL and
ATTR_FLAG_IMMUTABLE != EXT2_IMMUTABLE_FL.

This one is actually from Andreas (credit where credit is due).

Jes

diff -urN -X exclude-linux tmp/native-2.3.16/fs/ext2/inode.c linux-m68k/fs/ext2/inode.c
--- tmp/native-2.3.16/fs/ext2/inode.c Thu Aug 26 12:34:11 1999
+++ linux-m68k/fs/ext2/inode.c Fri Aug 20 10:13:26 1999
@@ -856,10 +856,11 @@
unsigned int flags;

retval = -EPERM;
- if ((iattr->ia_attr_flags &
- (ATTR_FLAG_APPEND | ATTR_FLAG_IMMUTABLE)) ^
- (inode->u.ext2_i.i_flags &
- (EXT2_APPEND_FL | EXT2_IMMUTABLE_FL))) {
+ if (iattr->ia_valid & ATTR_ATTR_FLAG &&
+ ((!(iattr->ia_attr_flags & ATTR_FLAG_APPEND) !=
+ !(inode->u.ext2_i.i_flags & EXT2_APPEND_FL)) ||
+ (!(iattr->ia_attr_flags & ATTR_FLAG_IMMUTABLE) !=
+ !(inode->u.ext2_i.i_flags & EXT2_IMMUTABLE_FL)))) {
if (!capable(CAP_LINUX_IMMUTABLE))
goto out;
} else if ((current->fsuid != inode->i_uid) && !capable(CAP_FOWNER))

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/