mirror of https://github.com/vitalif/e2fsprogs
203e13cf9c
In the loop in ext2fs_get_free_blocks2, we ask the bitmap if there's a range of free blocks starting at "b" and ending at "b + num - 1". That quantity is the number of the last block in the range. Since ext2fs_blocks_count() returns the number of blocks and not the number of the last block in the filesystem, the check is incorrect. Put in a shortcut to exit the loop if finish > start, because in that case it's obvious that we don't need to reset to the beginning of the FS to continue the search for blocks. This is needed to terminate the loop because the broken test meant that b could get large enough to equal finish, which would end the while loop. The attached testcase shows that with the off by one error, it is possible to throw e2fsck into an infinite loop while it tries to find space for the inode table even though there's no space for one. Signed-off-by: Darrick J. Wong <darrick.wong@oracle.com> Signed-off-by: Theodore Ts'o <tytso@mit.edu> |
||
---|---|---|
.. | ||
expect.1 | ||
expect.2 | ||
image.bz2 | ||
name | ||
script |