]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
block: make sure ->nr_integrity_segments is cloned in blk_rq_prep_clone
authorMing Lei <ming.lei@redhat.com>
Mon, 10 Mar 2025 11:54:53 +0000 (19:54 +0800)
committerJens Axboe <axboe@kernel.dk>
Mon, 10 Mar 2025 13:41:25 +0000 (07:41 -0600)
Make sure ->nr_integrity_segments is cloned in blk_rq_prep_clone(),
otherwise requests cloned by device-mapper multipath will not have the
proper nr_integrity_segments values set, then BUG() is hit from
sg_alloc_table_chained().

Fixes: b0fd271d5fba ("block: add request clone interface (v2)")
Cc: stable@vger.kernel.org
Cc: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Ming Lei <ming.lei@redhat.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Link: https://lore.kernel.org/r/20250310115453.2271109-1-ming.lei@redhat.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq.c

index b9550a127c8e0b337cb9388b144ca0a2af2aae12..f1030d589a1bbe917aa58c1dbc3a96c631b8ac96 100644 (file)
@@ -3314,6 +3314,7 @@ int blk_rq_prep_clone(struct request *rq, struct request *rq_src,
                rq->special_vec = rq_src->special_vec;
        }
        rq->nr_phys_segments = rq_src->nr_phys_segments;
+       rq->nr_integrity_segments = rq_src->nr_integrity_segments;
 
        if (rq->bio && blk_crypto_rq_bio_prep(rq, rq->bio, gfp_mask) < 0)
                goto free_and_out;