| 1 |
http://bugs.gentoo.org/91751
|
| 2 |
|
| 3 |
2005-07-04 Theodore Ts'o <tytso@mit.edu>
|
| 4 |
|
| 5 |
* pass2.c (e2fsck_process_bad_inode): Fixed bug which could cause
|
| 6 |
e2fsck to core dump if a disconnected inode contained an
|
| 7 |
extended attribute. This was actually caused by two bugs.
|
| 8 |
The first bug is that if the inode has been fully fixed
|
| 9 |
up, the code will attempt to remove the inode from the
|
| 10 |
inode_bad_map without checking to see if this bitmap is
|
| 11 |
present. Since it is cleared at the end of pass 2, if
|
| 12 |
e2fsck_process_bad_inode is called in pass 4 (as it is for
|
| 13 |
disconnected inodes), this would result in a core dump.
|
| 14 |
This bug was mostly hidden by a second bug, which caused
|
| 15 |
e2fsck_process_bad_inode() to consider all inodes without
|
| 16 |
an extended attribute to be not fixed. (Addresses Debian
|
| 17 |
Bug: #316736)
|
| 18 |
|
| 19 |
--- e2fsck/pass2.c
|
| 20 |
+++ e2fsck/pass2.c
|
| 21 |
@@ -1184,27 +1184,29 @@
|
| 22 |
pctx.inode = &inode;
|
| 23 |
|
| 24 |
if (inode.i_file_acl &&
|
| 25 |
- !(fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_EXT_ATTR) &&
|
| 26 |
- fix_problem(ctx, PR_2_FILE_ACL_ZERO, &pctx)) {
|
| 27 |
- inode.i_file_acl = 0;
|
| 28 |
+ !(fs->super->s_feature_compat & EXT2_FEATURE_COMPAT_EXT_ATTR)) {
|
| 29 |
+ if (fix_problem(ctx, PR_2_FILE_ACL_ZERO, &pctx)) {
|
| 30 |
+ inode.i_file_acl = 0;
|
| 31 |
#ifdef EXT2FS_ENABLE_SWAPFS
|
| 32 |
- /*
|
| 33 |
- * This is a special kludge to deal with long symlinks
|
| 34 |
- * on big endian systems. i_blocks had already been
|
| 35 |
- * decremented earlier in pass 1, but since i_file_acl
|
| 36 |
- * hadn't yet been cleared, ext2fs_read_inode()
|
| 37 |
- * assumed that the file was short symlink and would
|
| 38 |
- * not have byte swapped i_block[0]. Hence, we have
|
| 39 |
- * to byte-swap it here.
|
| 40 |
- */
|
| 41 |
- if (LINUX_S_ISLNK(inode.i_mode) &&
|
| 42 |
- (fs->flags & EXT2_FLAG_SWAP_BYTES) &&
|
| 43 |
- (inode.i_blocks == fs->blocksize >> 9))
|
| 44 |
- inode.i_block[0] = ext2fs_swab32(inode.i_block[0]);
|
| 45 |
+ /*
|
| 46 |
+ * This is a special kludge to deal with long
|
| 47 |
+ * symlinks on big endian systems. i_blocks
|
| 48 |
+ * had already been decremented earlier in
|
| 49 |
+ * pass 1, but since i_file_acl hadn't yet
|
| 50 |
+ * been cleared, ext2fs_read_inode() assumed
|
| 51 |
+ * that the file was short symlink and would
|
| 52 |
+ * not have byte swapped i_block[0]. Hence,
|
| 53 |
+ * we have to byte-swap it here.
|
| 54 |
+ */
|
| 55 |
+ if (LINUX_S_ISLNK(inode.i_mode) &&
|
| 56 |
+ (fs->flags & EXT2_FLAG_SWAP_BYTES) &&
|
| 57 |
+ (inode.i_blocks == fs->blocksize >> 9))
|
| 58 |
+ inode.i_block[0] = ext2fs_swab32(inode.i_block[0]);
|
| 59 |
#endif
|
| 60 |
- inode_modified++;
|
| 61 |
- } else
|
| 62 |
- not_fixed++;
|
| 63 |
+ inode_modified++;
|
| 64 |
+ } else
|
| 65 |
+ not_fixed++;
|
| 66 |
+ }
|
| 67 |
|
| 68 |
if (!LINUX_S_ISDIR(inode.i_mode) && !LINUX_S_ISREG(inode.i_mode) &&
|
| 69 |
!LINUX_S_ISCHR(inode.i_mode) && !LINUX_S_ISBLK(inode.i_mode) &&
|
| 70 |
@@ -1302,7 +1304,7 @@
|
| 71 |
|
| 72 |
if (inode_modified)
|
| 73 |
e2fsck_write_inode(ctx, ino, &inode, "process_bad_inode");
|
| 74 |
- if (!not_fixed)
|
| 75 |
+ if (!not_fixed && ctx->inode_bad_map)
|
| 76 |
ext2fs_unmark_inode_bitmap(ctx->inode_bad_map, ino);
|
| 77 |
return 0;
|
| 78 |
}
|
| 79 |
|