diff mbox series

[net,1/1] net/rds: dma_map_sg is entitled to merge entries

Message ID 60efc69f-1f35-529d-a7ef-da0549cad143@oracle.com
State New
Headers show
Series [net,1/1] net/rds: dma_map_sg is entitled to merge entries | expand

Commit Message

Gerd Rausch Aug. 17, 2021, 5:04 p.m. UTC
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 c588072bba6b ("iommu/vt-d: Convert intel iommu driver to the iommu ops")

Simply put: Linux 5.11 and later.

Signed-off-by: Gerd Rausch <gerd.rausch@oracle.com>
---
 net/rds/ib_frmr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org Aug. 18, 2021, 10:40 p.m. UTC | #1
Hello:

This patch was applied to netdev/net.git (refs/heads/master):

On Tue, 17 Aug 2021 10:04:37 -0700 you wrote:
> 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 c588072bba6b ("iommu/vt-d: Convert intel iommu driver to the iommu ops")

> 

> [...]


Here is the summary with links:
  - [net,1/1] net/rds: dma_map_sg is entitled to merge entries
    https://git.kernel.org/netdev/net/c/fb4b1373dcab

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html
diff mbox series

Patch

diff --git a/net/rds/ib_frmr.c b/net/rds/ib_frmr.c
index 9b6ffff72f2d..28c1b0022178 100644
--- a/net/rds/ib_frmr.c
+++ b/net/rds/ib_frmr.c
@@ -131,9 +131,9 @@  static int rds_ib_post_reg_frmr(struct rds_ib_mr *ibmr)
 		cpu_relax();
 	}
 
-	ret = ib_map_mr_sg_zbva(frmr->mr, ibmr->sg, ibmr->sg_len,
+	ret = ib_map_mr_sg_zbva(frmr->mr, ibmr->sg, ibmr->sg_dma_len,
 				&off, PAGE_SIZE);
-	if (unlikely(ret != ibmr->sg_len))
+	if (unlikely(ret != ibmr->sg_dma_len))
 		return ret < 0 ? ret : -EINVAL;
 
 	if (cmpxchg(&frmr->fr_state,