diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2015-01-21 11:03:19 -0500 |
---|---|---|
committer | Anna Schumaker <Anna.Schumaker@Netapp.com> | 2015-01-30 10:47:48 -0500 |
commit | 5ae711a24601257f395c1f8746ac95be0cbd75e5 (patch) | |
tree | b1e3c4d6d07f1c175247e66a20278ad831af8813 /net | |
parent | afadc468eb309b7c48ffdc8fa4c72acbb9991613 (diff) |
xprtrdma: Free the pd if ib_query_qp() fails
If ib_query_qp() fails or the memory registration mode isn't
supported, don't leak the PD. An orphaned IB/core resource will
cause IB module removal to hang.
Fixes: bd7ed1d13304 ("RPC/RDMA: check selected memory registration ...")
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Reviewed-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'net')
-rw-r--r-- | net/sunrpc/xprtrdma/verbs.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/net/sunrpc/xprtrdma/verbs.c b/net/sunrpc/xprtrdma/verbs.c index c61bb61c4d13..aa012a393448 100644 --- a/net/sunrpc/xprtrdma/verbs.c +++ b/net/sunrpc/xprtrdma/verbs.c | |||
@@ -614,7 +614,7 @@ rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr *addr, int memreg) | |||
614 | if (rc) { | 614 | if (rc) { |
615 | dprintk("RPC: %s: ib_query_device failed %d\n", | 615 | dprintk("RPC: %s: ib_query_device failed %d\n", |
616 | __func__, rc); | 616 | __func__, rc); |
617 | goto out2; | 617 | goto out3; |
618 | } | 618 | } |
619 | 619 | ||
620 | if (devattr.device_cap_flags & IB_DEVICE_LOCAL_DMA_LKEY) { | 620 | if (devattr.device_cap_flags & IB_DEVICE_LOCAL_DMA_LKEY) { |
@@ -672,14 +672,14 @@ rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr *addr, int memreg) | |||
672 | "phys register failed with %lX\n", | 672 | "phys register failed with %lX\n", |
673 | __func__, PTR_ERR(ia->ri_bind_mem)); | 673 | __func__, PTR_ERR(ia->ri_bind_mem)); |
674 | rc = -ENOMEM; | 674 | rc = -ENOMEM; |
675 | goto out2; | 675 | goto out3; |
676 | } | 676 | } |
677 | break; | 677 | break; |
678 | default: | 678 | default: |
679 | printk(KERN_ERR "RPC: Unsupported memory " | 679 | printk(KERN_ERR "RPC: Unsupported memory " |
680 | "registration mode: %d\n", memreg); | 680 | "registration mode: %d\n", memreg); |
681 | rc = -ENOMEM; | 681 | rc = -ENOMEM; |
682 | goto out2; | 682 | goto out3; |
683 | } | 683 | } |
684 | dprintk("RPC: %s: memory registration strategy is %d\n", | 684 | dprintk("RPC: %s: memory registration strategy is %d\n", |
685 | __func__, memreg); | 685 | __func__, memreg); |
@@ -689,6 +689,10 @@ rpcrdma_ia_open(struct rpcrdma_xprt *xprt, struct sockaddr *addr, int memreg) | |||
689 | 689 | ||
690 | rwlock_init(&ia->ri_qplock); | 690 | rwlock_init(&ia->ri_qplock); |
691 | return 0; | 691 | return 0; |
692 | |||
693 | out3: | ||
694 | ib_dealloc_pd(ia->ri_pd); | ||
695 | ia->ri_pd = NULL; | ||
692 | out2: | 696 | out2: |
693 | rdma_destroy_id(ia->ri_id); | 697 | rdma_destroy_id(ia->ri_id); |
694 | ia->ri_id = NULL; | 698 | ia->ri_id = NULL; |