Fix byte swapping bug in get_next_inode_full()

On big-endian systems, while swapping, ext2fs_swap_inode_full() swaps
only 128+extra_isize bytes and the EAs if they are present. Now if inode
N has EAs, (and this is the inode in the "scratch inode") then inode N+1
also carries seems to have them since the "scratch inode" was never
zeroed.

Signed-off-by: Kalpak Shah <kalpak@clusterfs.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
bitmap-optimize
Kalpak Shah 2007-06-29 21:40:19 -04:00 committed by Theodore Ts'o
parent d7b64725ee
commit 1ed49d2c2a
2 changed files with 9 additions and 0 deletions

View File

@ -1,3 +1,10 @@
2007-06-29 Theodore Tso <tytso@mit.edu>
* inode.c (ext2fs_get_next_inode_full): Whe byte swapping, make
sure the inode buffer is cleared first so that the
previous contents don't get mistaken as part of the new
(next) inode.
2006-06-24 Theodore Ts'o <tytso@mit.edu>
* Release of E2fsprogs 1.40

View File

@ -454,6 +454,7 @@ errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, ext2_ino_t *ino,
scan->bytes_left -= scan->inode_size - extra_bytes;
#ifdef EXT2FS_ENABLE_SWAPFS
memset(inode, 0, bufsize);
if ((scan->fs->flags & EXT2_FLAG_SWAP_BYTES) ||
(scan->fs->flags & EXT2_FLAG_SWAP_BYTES_READ))
ext2fs_swap_inode_full(scan->fs,
@ -468,6 +469,7 @@ errcode_t ext2fs_get_next_inode_full(ext2_inode_scan scan, ext2_ino_t *ino,
scan->scan_flags &= ~EXT2_SF_BAD_EXTRA_BYTES;
} else {
#ifdef EXT2FS_ENABLE_SWAPFS
memset(inode, 0, bufsize);
if ((scan->fs->flags & EXT2_FLAG_SWAP_BYTES) ||
(scan->fs->flags & EXT2_FLAG_SWAP_BYTES_READ))
ext2fs_swap_inode_full(scan->fs,