dm integrity: correctly calculate the size of metadata area
authorMikulas Patocka <mpatocka@redhat.com>
Tue, 7 May 2019 18:28:35 +0000 (14:28 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 25 May 2019 16:23:39 +0000 (18:23 +0200)
commit9407680a7bb79c2f9135794ece94a4aecd2d17b7
treef0647f0bdd600552b984a7504a2c61265e4ca744
parent3b92ff729cb35d1421bfeacbd3a9ebcab6b3e71d
dm integrity: correctly calculate the size of metadata area

commit 30bba430ddf737978e40561198693ba91386dac1 upstream.

When we use separate devices for data and metadata, dm-integrity would
incorrectly calculate the size of the metadata device as if it had
512-byte block size - and it would refuse activation with larger block
size and smaller metadata device.

Fix this so that it takes actual block size into account, which fixes
the following reported issue:
https://gitlab.com/cryptsetup/cryptsetup/issues/450

Fixes: 356d9d52e122 ("dm integrity: allow separate metadata device")
Cc: stable@vger.kernel.org # v4.19+
Signed-off-by: Mikulas Patocka <mpatocka@redhat.com>
Signed-off-by: Mike Snitzer <snitzer@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/md/dm-integrity.c