]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
RDMA/umem: Fix truncation for block sizes >= 4G
authorJason Gunthorpe <jgg@nvidia.com>
Mon, 1 Jun 2026 16:52:31 +0000 (13:52 -0300)
committerJason Gunthorpe <jgg@nvidia.com>
Wed, 3 Jun 2026 12:37:34 +0000 (09:37 -0300)
When the iommu is used the linearization of the mapping can give a single
block that is very large split across multiple SG entries.

When __rdma_block_iter_next() reassembles the split SG entries it is
overflowing the 32 bit stack values and computed the wrong DMA addresses
for blocks after the truncation.

Use the right types to hold DMA addresses.

Link: https://patch.msgid.link/r/1-v1-88303e9e509f+f7-ib_umem_types_jgg@nvidia.com
Cc: stable@vger.kernel.org
Fixes: a808273a495c ("RDMA/verbs: Add a DMA iterator to return aligned contiguous memory blocks")
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/core/iter.c

index 8e543d100657eebd4cd475f91765c06f9921aee2..3ed351e8fcf6c99a0a70366322226295b5e626ee 100644 (file)
@@ -19,8 +19,8 @@ EXPORT_SYMBOL(__rdma_block_iter_start);
 
 bool __rdma_block_iter_next(struct ib_block_iter *biter)
 {
-       unsigned int block_offset;
-       unsigned int delta;
+       dma_addr_t block_offset;
+       dma_addr_t delta;
 
        if (!biter->__sg_nents || !biter->__sg)
                return false;