]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
blk-mq-dma: always initialize dma state
authorKeith Busch <kbusch@kernel.org>
Wed, 10 Dec 2025 10:43:46 +0000 (02:43 -0800)
committerJens Axboe <axboe@kernel.dk>
Wed, 10 Dec 2025 20:41:11 +0000 (13:41 -0700)
Ensure the dma state is initialized when we're not using the contiguous
iova, otherwise the caller may be using a stale state from a previous
request that could use the coalesed iova allocation.

Fixes: 2f6b2565d43cdb5 ("block: accumulate memory segment gaps per bio")
Reported-by: Sebastian Ott <sebott@redhat.com>
Tested-by: Sebastian Ott <sebott@redhat.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
block/blk-mq-dma.c

index e9108ccaf4b061e12afb9a3778c3c325a9f0b3f3..6dc7a3c23ac8d1e41829ea87a630037415f00d7d 100644 (file)
@@ -199,6 +199,7 @@ static bool blk_dma_map_iter_start(struct request *req, struct device *dma_dev,
        if (blk_can_dma_map_iova(req, dma_dev) &&
            dma_iova_try_alloc(dma_dev, state, vec.paddr, total_len))
                return blk_rq_dma_map_iova(req, dma_dev, state, iter, &vec);
+       memset(state, 0, sizeof(*state));
        return blk_dma_map_direct(req, dma_dev, iter, &vec);
 }