netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net 1/1] net/rds: dma_map_sg is entitled to merge entries
@ 2021-08-17 17:04 Gerd Rausch
  2021-08-17 17:07 ` Santosh Shilimkar
  2021-08-18 22:40 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Gerd Rausch @ 2021-08-17 17:04 UTC (permalink / raw)
  To: Santosh Shilimkar, David S. Miller, Jakub Kicinski, netdev,
	linux-rdma, rds-devel

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(-)

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,
-- 
2.24.1


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

* Re: [PATCH net 1/1] net/rds: dma_map_sg is entitled to merge entries
  2021-08-17 17:04 [PATCH net 1/1] net/rds: dma_map_sg is entitled to merge entries Gerd Rausch
@ 2021-08-17 17:07 ` Santosh Shilimkar
  2021-08-18 22:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Santosh Shilimkar @ 2021-08-17 17:07 UTC (permalink / raw)
  To: Gerd Rausch
  Cc: David S. Miller, Jakub Kicinski, netdev, linux-rdma, rds-devel



> On Aug 17, 2021, at 10:04 AM, Gerd Rausch <gerd.rausch@oracle.com> 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")
> 
> 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(-)

Looks good to me Gerd. Thanks !!

Acked-by: Santosh Shilimkar <santosh.shilimkar@oracle.com>

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

* Re: [PATCH net 1/1] net/rds: dma_map_sg is entitled to merge entries
  2021-08-17 17:04 [PATCH net 1/1] net/rds: dma_map_sg is entitled to merge entries Gerd Rausch
  2021-08-17 17:07 ` Santosh Shilimkar
@ 2021-08-18 22:40 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-08-18 22:40 UTC (permalink / raw)
  To: Gerd Rausch; +Cc: santosh.shilimkar, davem, kuba, netdev, linux-rdma, rds-devel

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



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

end of thread, other threads:[~2021-08-18 22:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-17 17:04 [PATCH net 1/1] net/rds: dma_map_sg is entitled to merge entries Gerd Rausch
2021-08-17 17:07 ` Santosh Shilimkar
2021-08-18 22:40 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).