]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
dma-mapping: direct: fix missing mapping for THRU_HOST_BRIDGE segments
authorLi RongQing <lirongqing@baidu.com>
Wed, 3 Jun 2026 01:37:23 +0000 (09:37 +0800)
committerMarek Szyprowski <m.szyprowski@samsung.com>
Wed, 3 Jun 2026 06:52:40 +0000 (08:52 +0200)
In dma_direct_map_sg(), the case PCI_P2PDMA_MAP_THRU_HOST_BRIDGE
incorrectly used 'break' instead of falling through to MAP_NONE.
As a result, segments traversing the host bridge skipped the required
dma_direct_map_phys() call entirely, leaving sg->dma_address
uninitialized and leading to DMA failures. Fix this by using
'fallthrough;'.

Fixes: a25e7962db0d79 ("PCI/P2PDMA: Refactor the p2pdma mapping helpers")
Reviewed-by: Logan Gunthorpe <logang@deltatee.com>
Signed-off-by: Li RongQing <lirongqing@baidu.com>
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Link: https://lore.kernel.org/r/20260603013723.2439-1-lirongqing@baidu.com
kernel/dma/direct.c

index 583c5922bca2dac2910037685ec1aaa85665b871..4391b797d4db81b28108eed816fb089f095a582d 100644 (file)
@@ -476,7 +476,7 @@ int dma_direct_map_sg(struct device *dev, struct scatterlist *sgl, int nents,
                         * must be mapped with CPU physical address and not PCI
                         * bus addresses.
                         */
-                       break;
+                       fallthrough;
                case PCI_P2PDMA_MAP_NONE:
                        need_sync = true;
                        sg->dma_address = dma_direct_map_phys(dev, sg_phys(sg),