]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
block: set bip_vcnt correctly
authorAnuj Gupta <anuj20.g@samsung.com>
Wed, 26 Jun 2024 10:06:52 +0000 (15:36 +0530)
committerJens Axboe <axboe@kernel.dk>
Fri, 28 Jun 2024 20:34:54 +0000 (14:34 -0600)
Set the bip_vcnt correctly in bio_integrity_init_user and
bio_integrity_copy_user. If the bio gets split at a later point,
this value is required to set the right bip_vcnt in the cloned bio.

Signed-off-by: Anuj Gupta <anuj20.g@samsung.com>
Signed-off-by: Kanchan Joshi <joshi.k@samsung.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20240626100700.3629-3-anuj20.g@samsung.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/bio-integrity.c

index ad296849aa2a9a8b150c521c11a8c1b0c5fef869..eb3d7bbe1fe83a618ada6014eba71756a4b81105 100644 (file)
@@ -254,6 +254,7 @@ static int bio_integrity_copy_user(struct bio *bio, struct bio_vec *bvec,
 
        bip->bip_flags |= BIP_INTEGRITY_USER | BIP_COPY_USER;
        bip->bip_iter.bi_sector = seed;
+       bip->bip_vcnt = nr_vecs;
        return 0;
 free_bip:
        bio_integrity_free(bio);
@@ -275,6 +276,7 @@ static int bio_integrity_init_user(struct bio *bio, struct bio_vec *bvec,
        bip->bip_flags |= BIP_INTEGRITY_USER;
        bip->bip_iter.bi_sector = seed;
        bip->bip_iter.bi_size = len;
+       bip->bip_vcnt = nr_vecs;
        return 0;
 }