]> git.karo-electronics.de Git - karo-tx-linux.git/commit
ext4: Fix different block exchange issue in EXT4_IOC_MOVE_EXT
authorAkira Fujita <a-fujita@rs.jp.nec.com>
Wed, 16 Sep 2009 18:25:39 +0000 (14:25 -0400)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 14 Dec 2009 16:06:48 +0000 (08:06 -0800)
commit45d2735a0725d39b77a22cf535566ed570d6fc0a
treea776ea454e92f44aad77d3913b2a28565632c356
parentf9211e5e69570ec989a5297d1637229340cadb61
ext4: Fix different block exchange issue in EXT4_IOC_MOVE_EXT

(cherry picked from commit c40ce3c9ea97425a12d7e44031a98fe50add6fc1)

If logical block offset of original file which is passed to
EXT4_IOC_MOVE_EXT is different from donor file's,
a calculation error occurs in ext4_calc_swap_extents(),
therefore wrong block is exchanged between original file and donor file.
As a result, we hit ext4_error() in check_block_validity().
To detect the logical offset difference in EXT4_IOC_MOVE_EXT,
add checks to mext_calc_swap_extents() and handle it as error,
since data exchange must be done between the same blocks in EXT4_IOC_MOVE_EXT.

Reported-by: Peng Tao <bergwolf@gmail.com>
Signed-off-by: Akira Fujita <a-fujita@rs.jp.nec.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/ext4/move_extent.c