summaryrefslogtreecommitdiffstats
path: root/block
diff options
context:
space:
mode:
authorMartin K. Petersen <martin.petersen@oracle.com>2022-02-03 22:42:09 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2022-02-08 18:16:28 +0100
commitc237216a64908a086a8f4b2a8016d7291dc26bad (patch)
treeff39d7d3195525ca02d7b59eb46481047a0e0a96 /block
parent909d3ec1bf9f0ec534bfc081b77c0836fea7b0e2 (diff)
downloadlinux-stable-c237216a64908a086a8f4b2a8016d7291dc26bad.tar.gz
linux-stable-c237216a64908a086a8f4b2a8016d7291dc26bad.tar.bz2
linux-stable-c237216a64908a086a8f4b2a8016d7291dc26bad.zip
block: bio-integrity: Advance seed correctly for larger interval sizes
commit b13e0c71856817fca67159b11abac350e41289f5 upstream. Commit 309a62fa3a9e ("bio-integrity: bio_integrity_advance must update integrity seed") added code to update the integrity seed value when advancing a bio. However, it failed to take into account that the integrity interval might be larger than the 512-byte block layer sector size. This broke bio splitting on PI devices with 4KB logical blocks. The seed value should be advanced by bio_integrity_intervals() and not the number of sectors. Cc: Dmitry Monakhov <dmonakhov@openvz.org> Cc: stable@vger.kernel.org Fixes: 309a62fa3a9e ("bio-integrity: bio_integrity_advance must update integrity seed") Tested-by: Dmitry Ivanov <dmitry.ivanov2@hpe.com> Reported-by: Alexey Lyashkov <alexey.lyashkov@hpe.com> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com> Link: https://lore.kernel.org/r/20220204034209.4193-1-martin.petersen@oracle.com Signed-off-by: Jens Axboe <axboe@kernel.dk> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'block')
-rw-r--r--block/bio-integrity.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/block/bio-integrity.c b/block/bio-integrity.c
index d3df44c3b43a..4cee9446ce58 100644
--- a/block/bio-integrity.c
+++ b/block/bio-integrity.c
@@ -417,7 +417,7 @@ void bio_integrity_advance(struct bio *bio, unsigned int bytes_done)
struct blk_integrity *bi = blk_get_integrity(bio->bi_disk);
unsigned bytes = bio_integrity_bytes(bi, bytes_done >> 9);
- bip->bip_iter.bi_sector += bytes_done >> 9;
+ bip->bip_iter.bi_sector += bio_integrity_intervals(bi, bytes_done >> 9);
bvec_iter_advance(bip->bip_vec, &bip->bip_iter, bytes);
}
EXPORT_SYMBOL(bio_integrity_advance);