Commit f022fa88 authored by Sagi Grimberg's avatar Sagi Grimberg Committed by Doug Ledford

xprtrdma: Don't require LOCAL_DMA_LKEY support for fastreg

There is no need to require LOCAL_DMA_LKEY support as the
PD allocation makes sure that there is a local_dma_lkey. Also
correctly set a return value in error path.

This caused a NULL pointer dereference in mlx5 which removed
the support for LOCAL_DMA_LKEY.

Fixes: bb6c96d7 ("xprtrdma: Replace global lkey with lkey local to PD")
Signed-off-by: default avatarSagi Grimberg <sagig@mellanox.com>
Reviewed-by: default avatarChuck Lever <chuck.lever@oracle.com>
Acked-by: default avatarAnna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 3805eade
...@@ -543,10 +543,7 @@ rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr *addr, int memreg) ...@@ -543,10 +543,7 @@ rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr *addr, int memreg)
} }
if (memreg == RPCRDMA_FRMR) { if (memreg == RPCRDMA_FRMR) {
/* Requires both frmr reg and local dma lkey */ if (!(devattr->device_cap_flags & IB_DEVICE_MEM_MGT_EXTENSIONS) ||
if (((devattr->device_cap_flags &
(IB_DEVICE_MEM_MGT_EXTENSIONS|IB_DEVICE_LOCAL_DMA_LKEY)) !=
(IB_DEVICE_MEM_MGT_EXTENSIONS|IB_DEVICE_LOCAL_DMA_LKEY)) ||
(devattr->max_fast_reg_page_list_len == 0)) { (devattr->max_fast_reg_page_list_len == 0)) {
dprintk("RPC: %s: FRMR registration " dprintk("RPC: %s: FRMR registration "
"not supported by HCA\n", __func__); "not supported by HCA\n", __func__);
...@@ -557,6 +554,7 @@ rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr *addr, int memreg) ...@@ -557,6 +554,7 @@ rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr *addr, int memreg)
if (!ia->ri_device->alloc_fmr) { if (!ia->ri_device->alloc_fmr) {
dprintk("RPC: %s: MTHCAFMR registration " dprintk("RPC: %s: MTHCAFMR registration "
"not supported by HCA\n", __func__); "not supported by HCA\n", __func__);
rc = -EINVAL;
goto out3; goto out3;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment