summaryrefslogtreecommitdiff
path: root/drivers/md/dm-verity-fec.c
diff options
context:
space:
mode:
authorMikulas Patocka <mpatocka@redhat.com>2023-11-28 14:50:23 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-12-08 08:52:16 +0100
commit99277dd29051e2c28d865c5100e355d32803a997 (patch)
treeeba9c30b7b7ede6faa537a0b3b9aafaf93b465f9 /drivers/md/dm-verity-fec.c
parent5368a515a37fdbc65f85d3c08374e667a40a7981 (diff)
downloadlinux-99277dd29051e2c28d865c5100e355d32803a997.tar.gz
linux-99277dd29051e2c28d865c5100e355d32803a997.tar.bz2
linux-99277dd29051e2c28d865c5100e355d32803a997.zip
dm-verity: align struct dm_verity_fec_io properly
commit 38bc1ab135db87577695816b190e7d6d8ec75879 upstream. dm_verity_fec_io is placed after the end of two hash digests. If the hash digest has unaligned length, struct dm_verity_fec_io could be unaligned. This commit fixes the placement of struct dm_verity_fec_io, so that it's aligned. Signed-off-by: Mikulas Patocka <mpatocka@redhat.com> Cc: stable@vger.kernel.org Fixes: a739ff3f543a ("dm verity: add support for forward error correction") Signed-off-by: Mike Snitzer <snitzer@kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/md/dm-verity-fec.c')
-rw-r--r--drivers/md/dm-verity-fec.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/md/dm-verity-fec.c b/drivers/md/dm-verity-fec.c
index 2099c755119e..b475200d8586 100644
--- a/drivers/md/dm-verity-fec.c
+++ b/drivers/md/dm-verity-fec.c
@@ -24,7 +24,8 @@ bool verity_fec_is_enabled(struct dm_verity *v)
*/
static inline struct dm_verity_fec_io *fec_io(struct dm_verity_io *io)
{
- return (struct dm_verity_fec_io *) verity_io_digest_end(io->v, io);
+ return (struct dm_verity_fec_io *)
+ ((char *)io + io->v->ti->per_io_data_size - sizeof(struct dm_verity_fec_io));
}
/*