]> git.ipfire.org Git - thirdparty/xfsprogs-dev.git/commit
repair: check ino alignment value to avoid mod by zero
authorBrian Foster <bfoster@redhat.com>
Thu, 5 Feb 2015 23:32:32 +0000 (10:32 +1100)
committerDave Chinner <david@fromorbit.com>
Thu, 5 Feb 2015 23:32:32 +0000 (10:32 +1100)
commitca0a799ea95aceca7eda2c89d7a06549a4333cab
treeed40ebfddf9af4db5a66c0862f606b26f2423f41
parent16e16276896509e05330f7bff988bdfb1130c89b
repair: check ino alignment value to avoid mod by zero

xfs_repair checks inode records for valid alignment according to the
alignment specified in the superblock. It currently performs the
alignment check whenever fs_aligned_inodes is set, which is determined
based on whether the fs supports the field.

Support for the field does not guarantee its value is non-zero, however.
For example, a large block size fs on a large page size arch (e.g.,
ppc64):

mkfs.xfs -f -m crc=1,finobt=1 -b size=64k <dev>

... can lead to incorrect badly aligned inode record messages from
xfs_repair and other problems.

Update the inobt and finobt checks to verify that alignment is a
non-zero value before attempting to use it to divide (mod) by zero.

Signed-off-by: Brian Foster <bfoster@redhat.com>
Reviewed-by: Dave Chinner <dchinner@redhat.com>
Signed-off-by: Dave Chinner <david@fromorbit.com>
repair/scan.c