lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 22 Jun 2007 19:54:32 -0400
From:	Theodore Tso <tytso@....edu>
To:	Kalpak Shah <kalpak@...sterfs.com>
Cc:	linux-ext4 <linux-ext4@...r.kernel.org>,
	Andreas Dilger <adilger@...sterfs.com>
Subject: Re: [PATCH] Endianness bugs in e2fsck

Here's what I've committed into the e2fsprogs tree.

						- Ted

# HG changeset patch
# User tytso@....edu
# Date 1182556401 14400
# Node ID deeb424beb36d9fb1ff401aca7a5761a451436b8
# Parent  702632e66380e459f60b238570edd1e911dd46bc
Fix byte-swapping issues for the i_extra_size field

Thanks to Andreas Dilger and Kalpak Shah for spotting this problem.

Signed-off-by: "Theodore Ts'o" <tytso@....edu>

diff -r 702632e66380 -r deeb424beb36 lib/ext2fs/ChangeLog
--- a/lib/ext2fs/ChangeLog	Fri Jun 22 02:22:38 2007 -0400
+++ b/lib/ext2fs/ChangeLog	Fri Jun 22 19:53:21 2007 -0400
@@ -1,3 +1,8 @@ 2007-06-12  Theodore Tso  <tytso@....edu
+2007-06-22  Theodore Tso  <tytso@....edu>
+
+	* swapfs.c (ext2fs_swap_inode_full): Fix byte-swapping issues for
+		i_extra_size field.
+
 2007-06-12  Theodore Tso  <tytso@....edu>
 
 	* openfs.c (ext2fs_open2): We now set EXT2_FLAG_MASTER_SB_ONLY
diff -r 702632e66380 -r deeb424beb36 lib/ext2fs/swapfs.c
--- a/lib/ext2fs/swapfs.c	Fri Jun 22 02:22:38 2007 -0400
+++ b/lib/ext2fs/swapfs.c	Fri Jun 22 19:53:21 2007 -0400
@@ -133,7 +133,7 @@ void ext2fs_swap_inode_full(ext2_filsys 
 			    struct ext2_inode_large *f, int hostorder,
 			    int bufsize)
 {
-	unsigned i, has_data_blocks;
+	unsigned i, has_data_blocks, extra_isize;
 	int islnk = 0;
 	__u32 *eaf, *eat;
 
@@ -214,31 +214,35 @@ void ext2fs_swap_inode_full(ext2_filsys 
 	if (bufsize < (int) (sizeof(struct ext2_inode) + sizeof(__u16)))
 		return; /* no i_extra_isize field */
 
+	if (hostorder)
+		extra_isize = f->i_extra_isize;
 	t->i_extra_isize = ext2fs_swab16(f->i_extra_isize);
-	if (t->i_extra_isize > EXT2_INODE_SIZE(fs->super) -
+	if (!hostorder)
+		extra_isize = t->i_extra_isize;
+	if (extra_isize > EXT2_INODE_SIZE(fs->super) -
 				sizeof(struct ext2_inode)) {
 		/* this is error case: i_extra_size is too large */
 		return;
 	}
 
-	i = sizeof(struct ext2_inode) + t->i_extra_isize + sizeof(__u32);
+	i = sizeof(struct ext2_inode) + extra_isize + sizeof(__u32);
 	if (bufsize < (int) i)
 		return; /* no space for EA magic */
 
 	eaf = (__u32 *) (((char *) f) + sizeof(struct ext2_inode) +
-					f->i_extra_isize);
+					extra_isize);
 
 	if (ext2fs_swab32(*eaf) != EXT2_EXT_ATTR_MAGIC)
 		return; /* it seems no magic here */
 
 	eat = (__u32 *) (((char *) t) + sizeof(struct ext2_inode) +
-					f->i_extra_isize);
+					extra_isize);
 	*eat = ext2fs_swab32(*eaf);
 
 	/* convert EA(s) */
 	ext2fs_swap_ext_attr((char *) (eat + 1), (char *) (eaf + 1),
 			     bufsize - sizeof(struct ext2_inode) -
-			     t->i_extra_isize - sizeof(__u32), 0);
+			     extra_isize - sizeof(__u32), 0);
 
 }
 
-
To unsubscribe from this list: send the line "unsubscribe linux-ext4" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ