Skip to content

Commit d4440a7

Browse files
nook1208gregkh
authored andcommitted
dm verity fec: fix hash block number in verity_fec_decode
commit ad4e80a upstream. The error correction data is computed as if data and hash blocks were concatenated. But hash block number starts from v->hash_start. So, we have to calculate hash block number based on that. Fixes: a739ff3 ("dm verity: add support for forward error correction") Cc: [email protected] Signed-off-by: Sunwook Eom <[email protected]> Reviewed-by: Sami Tolvanen <[email protected]> Signed-off-by: Mike Snitzer <[email protected]> Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent 3904bdf commit d4440a7

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/md/dm-verity-fec.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ int verity_fec_decode(struct dm_verity *v, struct dm_verity_io *io,
436436
fio->level++;
437437

438438
if (type == DM_VERITY_BLOCK_TYPE_METADATA)
439-
block += v->data_blocks;
439+
block = block - v->hash_start + v->data_blocks;
440440

441441
/*
442442
* For RS(M, N), the continuous FEC data is divided into blocks of N

0 commit comments

Comments
 (0)