e2fsprogs/e2fsprogs-1.39-symlink-byteswap.patch
Eric Sandeen 66fd3626d0 * Fri Jun 22 2007 Eric Sandeen <esandeen@redhat.com> 1.39-14
- Many coverity-found potential leaks, segfaults, etc (#239354)
- Fix debugfs segfaults when no fs open (#208416, #209330)
- Avoid recursive loops in logdump due to symlinks in /dev (#210371)
- Don't write changes to the backup superblocks by default (#229561)
- Correct byteswapping for fast symlinks with xattrs (#232663)
- e2fsck: added sanity check for xattr validation (#230193)
2007-06-22 17:04:55 +00:00

112 lines
4.0 KiB
Diff

# HG changeset patch
# User tytso@mit.edu
# Date 1176573631 14400
# Node ID aa8d65921c8922dfed73dd05027a097cc5946653
# Parent 4b2e34b5f7506f9f74b3fadf79280316d57e47d5
Correct byteswapping for fast symlinks with xattrs
Fix a problem byte-swapping fast symlinks inodes that contain extended
attributes.
Addresses Red Hat Bugzilla: #232663
Addresses LTC Bugzilla: #27634
Signed-off-by: "Bryn M. Reeves" <breeves@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Index: e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog
===================================================================
--- e2fsprogs-1.39-RHEL5.orig/e2fsck/ChangeLog
+++ e2fsprogs-1.39-RHEL5/e2fsck/ChangeLog
@@ -5,6 +5,14 @@
won't write out the backup superblocks until we're sure
that we want write them out.
+2007-04-14 Theodore Tso <tytso@mit.edu>
+
+ * pass2.c (e2fsck_process_bad_inode): Remove special kludge that
+ dealt with long symlinks on big endian systems. It turns
+ out this was a workaround to a bug described in Red Hat
+ Bugzilla #232663, with an odd twist. See comment #12 for
+ more details.
+
2007-03-28 Theodore Tso <tytso@mit.edu>
* pass1.c (e2fsck_pass1, check_ext_attr),
Index: e2fsprogs-1.39-RHEL5/e2fsck/pass2.c
===================================================================
--- e2fsprogs-1.39-RHEL5.orig/e2fsck/pass2.c
+++ e2fsprogs-1.39-RHEL5/e2fsck/pass2.c
@@ -1187,22 +1187,6 @@ extern int e2fsck_process_bad_inode(e2fs
!(fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_EXT_ATTR)) {
if (fix_problem(ctx, PR_2_FILE_ACL_ZERO, &pctx)) {
inode.i_file_acl = 0;
-#ifdef EXT2FS_ENABLE_SWAPFS
- /*
- * This is a special kludge to deal with long
- * symlinks on big endian systems. i_blocks
- * had already been decremented earlier in
- * pass 1, but since i_file_acl hadn't yet
- * been cleared, ext2fs_read_inode() assumed
- * that the file was short symlink and would
- * not have byte swapped i_block[0]. Hence,
- * we have to byte-swap it here.
- */
- if (LINUX_S_ISLNK(inode.i_mode) &&
- (fs->flags & EXT2_FLAG_SWAP_BYTES) &&
- (inode.i_blocks == fs->blocksize >> 9))
- inode.i_block[0] = ext2fs_swab32(inode.i_block[0]);
-#endif
inode_modified++;
} else
not_fixed++;
Index: e2fsprogs-1.39-RHEL5/lib/ext2fs/swapfs.c
===================================================================
--- e2fsprogs-1.39-RHEL5.orig/lib/ext2fs/swapfs.c
+++ e2fsprogs-1.39-RHEL5/lib/ext2fs/swapfs.c
@@ -124,7 +124,7 @@ void ext2fs_swap_inode_full(ext2_filsys
struct ext2_inode_large *f, int hostorder,
int bufsize)
{
- unsigned i;
+ unsigned i, has_data_blocks;
int islnk = 0;
__u32 *eaf, *eat;
@@ -141,11 +141,17 @@ void ext2fs_swap_inode_full(ext2_filsys
t->i_dtime = ext2fs_swab32(f->i_dtime);
t->i_gid = ext2fs_swab16(f->i_gid);
t->i_links_count = ext2fs_swab16(f->i_links_count);
+ if (hostorder)
+ has_data_blocks = ext2fs_inode_data_blocks(fs,
+ (struct ext2_inode *) f);
t->i_blocks = ext2fs_swab32(f->i_blocks);
+ if (!hostorder)
+ has_data_blocks = ext2fs_inode_data_blocks(fs,
+ (struct ext2_inode *) t);
t->i_flags = ext2fs_swab32(f->i_flags);
t->i_file_acl = ext2fs_swab32(f->i_file_acl);
t->i_dir_acl = ext2fs_swab32(f->i_dir_acl);
- if (!islnk || ext2fs_inode_data_blocks(fs, (struct ext2_inode *)t)) {
+ if (!islnk || has_data_blocks ) {
for (i = 0; i < EXT2_N_BLOCKS; i++)
t->i_block[i] = ext2fs_swab32(f->i_block[i]);
} else if (t != f) {
Index: e2fsprogs-1.39-RHEL5/lib/ext2fs/ChangeLog
===================================================================
--- e2fsprogs-1.39-RHEL5.orig/lib/ext2fs/ChangeLog
+++ e2fsprogs-1.39-RHEL5/lib/ext2fs/ChangeLog
@@ -5,6 +5,12 @@
write changes to the backup superblocks need to explicitly
clear this flag.
+2007-04-14 Theodore Tso <tytso@mit.edu>
+
+ * swapfs.c (ext2fs_swap_inode_full): Fix a problem byte-swapping
+ fast symlinks inodes that contain extended attributes.
+ (Addresses Red Hat Bugzilla #232663, LTC bugzilla #27634)
+
2007-03-21 Theodore Tso <tytso@mit.edu>
* imager.c (ext2fs_image_inode_write), inode.c