Whamcloud - gitweb
libext2fs: fix offset code in undo_write_tdb
authorMarcus Huewe <suse-tux@gmx.de>
Thu, 12 May 2016 19:35:04 +0000 (15:35 -0400)
committerTheodore Ts'o <tytso@mit.edu>
Thu, 12 May 2016 19:35:04 +0000 (15:35 -0400)
commita7ea2ec02c096fc6deb36ee04f6c4c33b904b21f
treefab0d8997d3f851d534b8da6fb35d198784de564
parentcc090a3634b6a43979c7242a80c4d457b7a08ae2
libext2fs: fix offset code in undo_write_tdb

The old code has some issues, for example, when backing up fs block 0
(can be reproduced via "mke2fs -z undo -b 1024 -E offset=1024 out 1024"):
* backing_blk_num is set to ULLONG_MAX instead of 0
* data is read from the beginning of the file instead of offset 1024
* data_ptr is set to read_ptr - 1024 ("invalid" address)

Hence, the wrong fs block is associated with the wrong data.
For details, see also commit 76da764639cbfcc998f13c263a11a4601bcb9961.

Signed-off-by: Marcus Huewe <suse-tux@gmx.de>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
lib/ext2fs/undo_io.c