Skip to content

Commit 43bd09d

Browse files
Honggang-LIrleon
authored andcommitted
RDMA/rtrs: Fix clt_path::max_pages_per_mr calculation
If device max_mr_size bits in the range [mr_page_shift+31:mr_page_shift] are zero, the `min3` function will set clt_path::max_pages_per_mr to zero. `alloc_path_reqs` will pass zero, which is invalid, as the third parameter to `ib_alloc_mr`. Fixes: 6a98d71 ("RDMA/rtrs: client: main functionality") Signed-off-by: Honggang LI <honggangli@163.com> Link: https://patch.msgid.link/20251229025617.13241-1-honggangli@163.com Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent 3c68cf6 commit 43bd09d

1 file changed

Lines changed: 1 addition & 0 deletions

File tree

drivers/infiniband/ulp/rtrs/rtrs-clt.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1464,6 +1464,7 @@ static void query_fast_reg_mode(struct rtrs_clt_path *clt_path)
14641464
mr_page_shift = max(12, ffs(ib_dev->attrs.page_size_cap) - 1);
14651465
max_pages_per_mr = ib_dev->attrs.max_mr_size;
14661466
do_div(max_pages_per_mr, (1ull << mr_page_shift));
1467+
max_pages_per_mr = min_not_zero((u32)max_pages_per_mr, U32_MAX);
14671468
clt_path->max_pages_per_mr =
14681469
min3(clt_path->max_pages_per_mr, (u32)max_pages_per_mr,
14691470
ib_dev->attrs.max_fast_reg_page_list_len);

0 commit comments

Comments
 (0)