Whamcloud - gitweb
e2fsck: Fix potential data corruptor bug in journal recovery
authorTheodore Ts'o <tytso@mit.edu>
Tue, 20 May 2008 18:51:14 +0000 (14:51 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Tue, 20 May 2008 18:51:14 +0000 (14:51 -0400)
commite5ea6b14eb93671525e01ec4a6100febe541bf67
tree9bc633d57474647a9d85fa1f24b4e9cc8ab4e5ef
parentae7ecef50f9d806951f0810c139ebc0fe780316c
e2fsck: Fix potential data corruptor bug in journal recovery

While synchronizing e2fsck's recovery.c with the latest 2.6 kernel
sources, I discovered a serious bug that apparently had been fixed in
the kernel sometime between Deceber 2003 and April 2005, but which had
not been carried over to e2fsprogs.  Specifically, when blocks whose
first 4 bytes are JFS_MAGIC_NUMBER (0xc03b3998) are written into the
journal, the first 4 bytes zero'ed out.  A one character typo meant
that when the blocks were replayed by e2fsck, the JFS_MAGIC_NUMBER
would not be restored.

Oops.

Fortunately, it is *highly* unlikely that ext4 metadata blocks will
contain that magic number in the first four bytes, and data=journalled
is a relatively rarely used.

This commit fixes this bug, as well as updating e2fsck's recovery.c to
be in sync with 2.6.25.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
e2fsck/jfs_user.h
e2fsck/recovery.c