diff options
author | Sagi Grimberg <sagig@mellanox.com> | 2015-10-06 12:52:37 -0400 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2015-10-06 14:23:00 -0400 |
commit | f022fa88ce6abc83c6e678a890df5c1e4b0eaf89 (patch) | |
tree | feea7955246663f847bafb3e6b6b8c3efae7029f /net/sunrpc | |
parent | 3805eade3b7c4a5ad593525703c2c82a84fd9b13 (diff) |
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: bb6c96d72879 ("xprtrdma: Replace global lkey with lkey local to PD")
Signed-off-by: Sagi Grimberg <sagig@mellanox.com>
Reviewed-by: Chuck Lever <chuck.lever@oracle.com>
Acked-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/xprtrdma/verbs.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index eb081ad05e33..81e8d31f3abc 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c | |||
@@ -543,11 +543,8 @@ rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr *addr, int memreg) | |||
543 | } | 543 | } |
544 | 544 | ||
545 | if (memreg == RPCRDMA_FRMR) { | 545 | if (memreg == RPCRDMA_FRMR) { |
546 | /* Requires both frmr reg and local dma lkey */ | 546 | if (!(devattr->device_cap_flags & IB_DEVICE_MEM_MGT_EXTENSIONS) || |
547 | if (((devattr->device_cap_flags & | 547 | (devattr->max_fast_reg_page_list_len == 0)) { |
548 | (IB_DEVICE_MEM_MGT_EXTENSIONS|IB_DEVICE_LOCAL_DMA_LKEY)) != | ||
549 | (IB_DEVICE_MEM_MGT_EXTENSIONS|IB_DEVICE_LOCAL_DMA_LKEY)) || | ||
550 | (devattr->max_fast_reg_page_list_len == 0)) { | ||
551 | dprintk("RPC: %s: FRMR registration " | 548 | dprintk("RPC: %s: FRMR registration " |
552 | "not supported by HCA\n", __func__); | 549 | "not supported by HCA\n", __func__); |
553 | memreg = RPCRDMA_MTHCAFMR; | 550 | memreg = RPCRDMA_MTHCAFMR; |
@@ -557,6 +554,7 @@ rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr *addr, int memreg) | |||
557 | if (!ia->ri_device->alloc_fmr) { | 554 | if (!ia->ri_device->alloc_fmr) { |
558 | dprintk("RPC: %s: MTHCAFMR registration " | 555 | dprintk("RPC: %s: MTHCAFMR registration " |
559 | "not supported by HCA\n", __func__); | 556 | "not supported by HCA\n", __func__); |
557 | rc = -EINVAL; | ||
560 | goto out3; | 558 | goto out3; |
561 | } | 559 | } |
562 | } | 560 | } |