RDMA/rxe: Fix "Replace mr by rkey in responder resources"
authorBob Pearson <rpearsonhpe@gmail.com>
Mon, 11 Apr 2022 03:06:48 +0000 (22:06 -0500)
committerJason Gunthorpe <jgg@nvidia.com>
Tue, 12 Apr 2022 14:17:52 +0000 (11:17 -0300)
commit290c4a902b79246ec55e477fc313f27f98393dee
tree9ab7931cb503f21576a52ac18ebe83ea4fd0497f
parentce522ba9ef7e2d9fb22a39eb3371c0c64e2a433e
RDMA/rxe: Fix "Replace mr by rkey in responder resources"

The referenced commit generates a reference counting error if the rkey has
the same index but the wrong key. In this case the reference taken by
rxe_pool_get_index() is not dropped.

Drop the reference if the keys don't match in rxe_recheck_mr().  Check
that the mw and mr are still valid.

Fixes: 8a1a0be894da ("RDMA/rxe: Replace mr by rkey in responder resources")
Link: https://lore.kernel.org/r/20220411030647.20011-1-rpearsonhpe@gmail.com
Signed-off-by: Bob Pearson <rpearsonhpe@gmail.com>
Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
drivers/infiniband/sw/rxe/rxe_resp.c