Linux RDMA and InfiniBand development
 help / color / mirror / Atom feed
* [PATCH rdma-rc] RDMA/mlx5: Don't WARN on a user iova that can't be mapped
@ 2026-11-29 11:54 Edward Srouji
  2026-11-29 11:58 ` sashiko-bot
  2026-11-29 14:19 ` Leon Romanovsky
  0 siblings, 2 replies; 4+ messages in thread
From: Edward Srouji @ 2026-11-29 11:54 UTC (permalink / raw)
  To: Leon Romanovsky, Jason Gunthorpe
  Cc: linux-rdma, linux-kernel, Yishai Hadas, Edward Srouji

From: Yishai Hadas <yishaih@nvidia.com>

alloc_cacheable_mr() and can_use_umr_rereg_pas() warn when no page size
fits the MR. The WARNs rely on ib_umem_find_best_pgsz() never returning
0 for drivers that support PAGE_SIZE, as its kdoc promises.

commit 09ea6837a043 ("RDMA/umem: Be careful about boundary
conditions in ib_umem_find_best_pgsz()") broke that promise, the
function now returns 0 when iova + length overflows. The iova is
provided by the user on MR registration and rereg, so any user can
trigger the WARN and panic a system running with panic_on_warn.

Drop the WARN in both places, and handle it as any other bad input.

Fixes: 09ea6837a043 ("RDMA/umem: Be careful about boundary conditions in ib_umem_find_best_pgsz()")
Signed-off-by: Yishai Hadas <yishaih@nvidia.com>
Signed-off-by: Edward Srouji <edwards@nvidia.com>
---
 drivers/infiniband/hw/mlx5/mr.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/infiniband/hw/mlx5/mr.c b/drivers/infiniband/hw/mlx5/mr.c
index 176f87ba062cd1f2dc8ca20f2a4018cb8df361b6..e3fc6cd06c2d03b01f0e6a60a71ee1cd5f76ea18 100644
--- a/drivers/infiniband/hw/mlx5/mr.c
+++ b/drivers/infiniband/hw/mlx5/mr.c
@@ -452,7 +452,7 @@ static struct mlx5_ib_mr *alloc_cacheable_mr(struct ib_pd *pd,
 	else
 		page_size = mlx5_umem_mkc_find_best_pgsz(dev, umem, iova,
 							 access_mode);
-	if (WARN_ON(!page_size))
+	if (!page_size)
 		return ERR_PTR(-EINVAL);
 
 	mr = _mlx5_frmr_pool_alloc(dev, umem, access_flags, access_mode,
@@ -1111,7 +1111,7 @@ static bool can_use_umr_rereg_pas(struct mlx5_ib_mr *mr,
 
 	*page_size =
 		mlx5_umem_mkc_find_best_pgsz(dev, new_umem, iova, access_mode);
-	if (WARN_ON(!*page_size))
+	if (!*page_size)
 		return false;
 	return (mr->ibmr.frmr.key.num_dma_blocks) >=
 	       ib_umem_num_dma_blocks(new_umem, *page_size);

---
base-commit: e7732ec135b501e87ab060d992b3b5f2ec4396c9
change-id: 20261129-mlx5-no-warn-page-size-d7aea7534cdb

Best regards,
-- 
Edward Srouji <edwards@nvidia.com>


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

end of thread, other threads:[~2026-11-29 15:23 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-11-29 11:54 [PATCH rdma-rc] RDMA/mlx5: Don't WARN on a user iova that can't be mapped Edward Srouji
2026-11-29 11:58 ` sashiko-bot
2026-11-29 14:19 ` Leon Romanovsky
2026-11-29 15:22   ` Edward Srouji

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox