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

Fix verity_fec_ctr() to reject too-small hash devices by correctly
taking hash_start into account.

Note that this is necessary because dm-verity doesn't call
dm_bufio_set_sector_offset() on the hash device's bufio client
(v->bufio).  Thus, dm_bufio_get_device_size(v->bufio) returns a size
relative to 0 rather than hash_start.  An alternative fix would be to
call dm_bufio_set_sector_offset() on v->bufio, but then all the code
that reads from the hash device would have to be adjusted accordingly.

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