Skip to content

Commit 36eee97

Browse files
gerd-rauschjfvogel
authored andcommitted
net/rds: dma_map_sg is entitled to merge entries
Function "dma_map_sg" is entitled to merge adjacent entries and return a value smaller than what was passed as "nents". Subsequently "ib_map_mr_sg" needs to work with this value ("sg_dma_len") rather than the original "nents" parameter ("sg_len"). This old RDS bug was exposed and reliably causes kernel panics (using RDMA operations "rds-stress -D") on x86_64 starting with: commit c588072 ("iommu/vt-d: Convert intel iommu driver to the iommu ops") Simply put: Linux 5.11 and later. Orabug: 33590097 Signed-off-by: Gerd Rausch <[email protected]> Reviewed-by: William Kucharski <[email protected]>
1 parent 6a62c92 commit 36eee97

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

net/rds/ib_rdma.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1547,8 +1547,8 @@ static int rds_ib_map_scatterlist(struct rds_ib_device *rds_ibdev,
15471547
return -EBUSY;
15481548
}
15491549

1550-
ret = ib_map_mr_sg_zbva(ibmr->mr, sg, sg_len, &off, PAGE_SIZE);
1551-
if (unlikely(ret != sg_len)) {
1550+
ret = ib_map_mr_sg_zbva(ibmr->mr, sg, sg_dma_len, &off, PAGE_SIZE);
1551+
if (unlikely(ret != sg_dma_len)) {
15521552
ibmr->fr_state = MR_IS_STALE;
15531553
ret = ret < 0 ? ret : -EINVAL;
15541554
goto out_unmap;

0 commit comments

Comments
 (0)