diff options
author | Chuck Lever <chuck.lever@oracle.com> | 2020-06-30 21:55:45 +0200 |
---|---|---|
committer | Chuck Lever <chuck.lever@oracle.com> | 2020-07-28 16:18:13 +0200 |
commit | 64d26422516b2e347b32e6d9b1d40b3c19a62aae (patch) | |
tree | 246fe694a3ee7442335be356ca3c7a908e4a2713 /net/sunrpc | |
parent | SUNRPC: Refresh the show_rqstp_flags() macro (diff) | |
download | linux-64d26422516b2e347b32e6d9b1d40b3c19a62aae.tar.xz linux-64d26422516b2e347b32e6d9b1d40b3c19a62aae.zip |
svcrdma: Fix another Receive buffer leak
During a connection tear down, the Receive queue is flushed before
the device resources are freed. Typically, all the Receives flush
with IB_WR_FLUSH_ERR.
However, any pending successful Receives flush with IB_WR_SUCCESS,
and the server automatically posts a fresh Receive to replace the
completing one. This happens even after the connection has closed
and the RQ is drained. Receives that are posted after the RQ is
drained appear never to complete, causing a Receive resource leak.
The leaked Receive buffer is left DMA-mapped.
To prevent these late-posted recv_ctxt's from leaking, block new
Receive posting after XPT_CLOSE is set.
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Diffstat (limited to 'net/sunrpc')
-rw-r--r-- | net/sunrpc/xprtrdma/svc_rdma_recvfrom.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c index d5ec85cb652c..5bb97b5f4606 100644 --- a/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c +++ b/net/sunrpc/xprtrdma/svc_rdma_recvfrom.c @@ -275,6 +275,8 @@ static int svc_rdma_post_recv(struct svcxprt_rdma *rdma) { struct svc_rdma_recv_ctxt *ctxt; + if (test_bit(XPT_CLOSE, &rdma->sc_xprt.xpt_flags)) + return 0; ctxt = svc_rdma_recv_ctxt_get(rdma); if (!ctxt) return -ENOMEM; |