]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
dm-verity-fec: correctly reject too-small FEC devices
authorEric Biggers <ebiggers@kernel.org>
Fri, 6 Feb 2026 04:59:20 +0000 (20:59 -0800)
committerMikulas Patocka <mpatocka@redhat.com>
Mon, 9 Mar 2026 14:10:48 +0000 (15:10 +0100)
commit2b14e0bb63cc671120e7791658f5c494fc66d072
treef4bcd347a5773c0b69b25a65e6f9d0383bde02ca
parentc20e36b7631d83e7535877f08af8b0af72c44b1a
dm-verity-fec: correctly reject too-small FEC devices

Fix verity_fec_ctr() to reject too-small FEC devices by correctly
computing the number of parity blocks as 'f->rounds * f->roots'.
Previously it incorrectly used 'div64_u64(f->rounds * f->roots,
v->fec->roots << SECTOR_SHIFT)' which is a much smaller value.

Note that the units of 'rounds' are blocks, not bytes.  This matches the
units of the value returned by dm_bufio_get_device_size(), which are
also blocks.  A later commit will give 'rounds' a clearer name.

Fixes: a739ff3f543a ("dm verity: add support for forward error correction")
Cc: stable@vger.kernel.org
Signed-off-by: Eric Biggers <ebiggers@kernel.org>
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
drivers/md/dm-verity-fec.c