Skip to content

Commit

Permalink
dm verity fec: fix hash block number in verity_fec_decode
Browse files Browse the repository at this point in the history
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: stable@vger.kernel.org
Signed-off-by: Sunwook Eom <speed.eom@samsung.com>
Reviewed-by: Sami Tolvanen <samitolvanen@google.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Sunwook Eom authored and Greg Kroah-Hartman committed May 5, 2020
1 parent 9199193 commit 779bb36
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion drivers/md/dm-verity-fec.c
Original file line number Diff line number Diff line change
@@ -447,7 +447,7 @@ int verity_fec_decode(struct dm_verity *v, struct dm_verity_io *io,
fio->level++;

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

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

0 comments on commit 779bb36

Please sign in to comment.