public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCHv2] blk-mq-dma: always initialize dma state
@ 2025-12-10 10:43 Keith Busch
  2025-12-10 15:18 ` Christoph Hellwig
  2025-12-10 20:41 ` Jens Axboe
  0 siblings, 2 replies; 3+ messages in thread
From: Keith Busch @ 2025-12-10 10:43 UTC (permalink / raw)
  To: linux-block, axboe, hch; +Cc: Keith Busch, Sebastian Ott

From: Keith Busch <kbusch@kernel.org>

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>
---
v1->v2:

  Simpler logic to always do the state initialization

 block/blk-mq-dma.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/block/blk-mq-dma.c b/block/blk-mq-dma.c
index e9108ccaf4b06..6dc7a3c23ac8d 100644
--- a/block/blk-mq-dma.c
+++ b/block/blk-mq-dma.c
@@ -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);
 }
 
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCHv2] blk-mq-dma: always initialize dma state
  2025-12-10 10:43 [PATCHv2] blk-mq-dma: always initialize dma state Keith Busch
@ 2025-12-10 15:18 ` Christoph Hellwig
  2025-12-10 20:41 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Christoph Hellwig @ 2025-12-10 15:18 UTC (permalink / raw)
  To: Keith Busch; +Cc: linux-block, axboe, hch, Keith Busch, Sebastian Ott

On Wed, Dec 10, 2025 at 02:43:46AM -0800, Keith Busch wrote:
> From: Keith Busch <kbusch@kernel.org>
> 
> 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.

Looks good:

Reviewed-by: Christoph Hellwig <hch@lst.de>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCHv2] blk-mq-dma: always initialize dma state
  2025-12-10 10:43 [PATCHv2] blk-mq-dma: always initialize dma state Keith Busch
  2025-12-10 15:18 ` Christoph Hellwig
@ 2025-12-10 20:41 ` Jens Axboe
  1 sibling, 0 replies; 3+ messages in thread
From: Jens Axboe @ 2025-12-10 20:41 UTC (permalink / raw)
  To: linux-block, hch, Keith Busch; +Cc: Keith Busch, Sebastian Ott


On Wed, 10 Dec 2025 02:43:46 -0800, Keith Busch wrote:
> 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.
> 
> 

Applied, thanks!

[1/1] blk-mq-dma: always initialize dma state
      commit: a0750fae73c55112ea11a4867bee40f11e679405

Best regards,
-- 
Jens Axboe




^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-12-10 20:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-10 10:43 [PATCHv2] blk-mq-dma: always initialize dma state Keith Busch
2025-12-10 15:18 ` Christoph Hellwig
2025-12-10 20:41 ` Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox