From 035236c9e135a2ce7d0f68cb56e63d4a3da2abe1 Mon Sep 17 00:00:00 2001 From: Josef Bacik Date: Wed, 28 Oct 2026 10:41:35 -0600 Subject: [PATCH] blk-mq-dma: initialize the dma state for P2P, too blk_rq_dma_map_iter_start() promises that the caller need not initialize the dma_iova_state, but the P2P bus address path returns before it does so. The state then holds what the last request with that tag left, and blk_rq_dma_map_coalesce() describes a transfer as one IOVA range that it isn't. Clear it on that path too. Fixes: 858299dc6160 ("block: add scatterlist-less DMA mapping helpers") Signed-off-by: Josef Bacik Reviewed-by: Christoph Hellwig Link: https://patch.msgid.link/20261028164415.1262013-33-axboe@kernel.dk Signed-off-by: Jens Axboe --- block/blk-mq-dma.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/block/blk-mq-dma.c b/block/blk-mq-dma.c index 88fd9cbc951f..e0e7a18790b5 100644 --- a/block/blk-mq-dma.c +++ b/block/blk-mq-dma.c @@ -181,6 +181,8 @@ static bool blk_dma_map_iter_start(struct request *req, struct device *dma_dev, switch (pci_p2pdma_state(&iter->p2pdma, dma_dev, phys_to_page(vec.paddr))) { case PCI_P2PDMA_MAP_BUS_ADDR: + /* don't leave the state of an earlier mapping to the caller */ + memset(state, 0, sizeof(*state)); return blk_dma_map_bus(iter, &vec); case PCI_P2PDMA_MAP_THRU_HOST_BRIDGE: /*