On Thu, Jan 19, 2023 at 12:05:07PM -0600, Bob Pearson wrote: > Correct errors in rxe_param.h caused by extending the range of > indices for MRs allowing it to overlap the range for MWs. Since > the driver determines whether an rkey is for an MR or MW by comparing > the index part of the rkey with these ranges this can cause an > MR to be incorrectly determined to be an MW. > > Additionally the parameters which determine the size of the index > ranges for MR, MW, QP and SRQ are incorrect since the actual > number of integers in the range [min, max] is (max - min + 1) not > (max - min). > > This patch corrects these errors. > > Fixes: 0994a1bcd5f7 ("RDMA/rxe: Bump up default maximum values used via uverbs") > Signed-off-by: Bob Pearson <rpearsonhpe@xxxxxxxxx> > --- > drivers/infiniband/sw/rxe/rxe_param.h | 27 +++++++++++++++++++-------- > 1 file changed, 19 insertions(+), 8 deletions(-) This commit 1aefe5c177c1922119afb4ee443ddd6ac3140b37 Author: Daisuke Matsuda <matsuda-daisuke@xxxxxxxxxxx> Date: Tue Dec 20 17:08:48 2022 +0900 RDMA/rxe: Prevent faulty rkey generation If you create MRs more than 0x10000 times after loading the module, responder starts to reply NAKs for RDMA/Atomic operations because of rkey violation detected in check_rkey(). The root cause is that rkeys are incremented each time a new MR is created and the value overflows into the range reserved for MWs. This commit also increases the value of RXE_MAX_MW that has been limited unlike other parameters. Fixes: 0994a1bcd5f7 ("RDMA/rxe: Bump up default maximum values used via uverbs") Link: https://lore.kernel.org/r/20221220080848.253785-2-matsuda-daisuke@xxxxxxxxxxx Signed-off-by: Daisuke Matsuda <matsuda-daisuke@xxxxxxxxxxx> Tested-by: Li Zhijian <lizhijian@xxxxxxxxxxx> Reviewed-by: Li Zhijian <lizhijian@xxxxxxxxxxx> Signed-off-by: Jason Gunthorpe <jgg@xxxxxxxxxx> Is already in v6.2-rc and conflicts with this patch, it looks like it is doing the same thing, can you sort it out please? Thanks, Jason