From: Theodore Ts'o Date: Wed, 10 Aug 2016 19:49:35 +0000 (-0400) Subject: resize2fs: fix crash when there is an ea block and no blocks to migrate X-Git-Tag: v1.43.2~22 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=3d6fc974831a360aee460e54c442538445f3017c;p=thirdparty%2Fe2fsprogs.git resize2fs: fix crash when there is an ea block and no blocks to migrate This fixes a bug introduced in 1.43 by commit fb47b94fffc: "resize2fs: rewrite extent/dir/ea block checksums when migrating". If there is an extended attribute block and there are no blocks that need to migrate, we will crash. The bug was caused by a botched De Morgan's transformation. Signed-off-by: Theodore Ts'o --- diff --git a/resize/resize2fs.c b/resize/resize2fs.c index 09419ce49..8f6d95e76 100644 --- a/resize/resize2fs.c +++ b/resize/resize2fs.c @@ -1895,7 +1895,7 @@ static errcode_t migrate_ea_block(ext2_resize_t rfs, ext2_ino_t ino, errcode_t err = 0; /* No EA block or no remapping? Quit early. */ - if (ext2fs_file_acl_block(rfs->old_fs, inode) == 0 && !rfs->bmap) + if (ext2fs_file_acl_block(rfs->old_fs, inode) == 0 || !rfs->bmap) return 0; new_block = extent_translate(rfs->old_fs, rfs->bmap, ext2fs_file_acl_block(rfs->old_fs, inode));