Commit 21515e46 authored by Steve Wise's avatar Steve Wise Committed by J. Bruce Fields

svcrdma: clean up error paths.

These fixes resolved crashes due to resource leak BUG_ON checks. The
resource leaks were detected by introducing asynchronous transport errors.
Signed-off-by: default avatarSteve Wise <swise@opengridcomputing.com>
Signed-off-by: default avatarTom Tucker <tom@opengridcomputing.com>
Signed-off-by: default avatarJ. Bruce Fields <bfields@citi.umich.edu>
parent d0687be7
...@@ -183,6 +183,7 @@ static int fast_reg_xdr(struct svcxprt_rdma *xprt, ...@@ -183,6 +183,7 @@ static int fast_reg_xdr(struct svcxprt_rdma *xprt,
fatal_err: fatal_err:
printk("svcrdma: Error fast registering memory for xprt %p\n", xprt); printk("svcrdma: Error fast registering memory for xprt %p\n", xprt);
vec->frmr = NULL;
svc_rdma_put_frmr(xprt, frmr); svc_rdma_put_frmr(xprt, frmr);
return -EIO; return -EIO;
} }
...@@ -516,6 +517,7 @@ static int send_reply(struct svcxprt_rdma *rdma, ...@@ -516,6 +517,7 @@ static int send_reply(struct svcxprt_rdma *rdma,
"svcrdma: could not post a receive buffer, err=%d." "svcrdma: could not post a receive buffer, err=%d."
"Closing transport %p.\n", ret, rdma); "Closing transport %p.\n", ret, rdma);
set_bit(XPT_CLOSE, &rdma->sc_xprt.xpt_flags); set_bit(XPT_CLOSE, &rdma->sc_xprt.xpt_flags);
svc_rdma_put_frmr(rdma, vec->frmr);
svc_rdma_put_context(ctxt, 0); svc_rdma_put_context(ctxt, 0);
return -ENOTCONN; return -ENOTCONN;
} }
...@@ -606,6 +608,7 @@ static int send_reply(struct svcxprt_rdma *rdma, ...@@ -606,6 +608,7 @@ static int send_reply(struct svcxprt_rdma *rdma,
return 0; return 0;
err: err:
svc_rdma_unmap_dma(ctxt);
svc_rdma_put_frmr(rdma, vec->frmr); svc_rdma_put_frmr(rdma, vec->frmr);
svc_rdma_put_context(ctxt, 1); svc_rdma_put_context(ctxt, 1);
return -EIO; return -EIO;
......
...@@ -520,8 +520,9 @@ int svc_rdma_post_recv(struct svcxprt_rdma *xprt) ...@@ -520,8 +520,9 @@ int svc_rdma_post_recv(struct svcxprt_rdma *xprt)
svc_xprt_get(&xprt->sc_xprt); svc_xprt_get(&xprt->sc_xprt);
ret = ib_post_recv(xprt->sc_qp, &recv_wr, &bad_recv_wr); ret = ib_post_recv(xprt->sc_qp, &recv_wr, &bad_recv_wr);
if (ret) { if (ret) {
svc_xprt_put(&xprt->sc_xprt); svc_rdma_unmap_dma(ctxt);
svc_rdma_put_context(ctxt, 1); svc_rdma_put_context(ctxt, 1);
svc_xprt_put(&xprt->sc_xprt);
} }
return ret; return ret;
......
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