Linux-RDMA Archive on
 help / color / Atom feed
From: Chuck Lever <>
Subject: [PATCH v1 1/3] svcrdma: Fix another Receive buffer leak
Date: Sun, 26 Jul 2020 16:59:45 -0400
Message-ID: <> (raw)

During a connection tear down, the Receive queue is flushed before
the device resources are freed. Typically, all the Receives flush

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 <>
 net/sunrpc/xprtrdma/svc_rdma_recvfrom.c |    2 ++
 1 file changed, 2 insertions(+)

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;

             reply index

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-26 20:59 Chuck Lever [this message]
2020-07-26 20:59 ` [PATCH v1 2/3] svcrdma: Remove transport reference counting Chuck Lever
2020-07-26 20:59 ` [PATCH v1 3/3] svcrdma: CM event handler clean up Chuck Lever

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \ \ \ \ \

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

Linux-RDMA Archive on

Archives are clonable:
	git clone --mirror linux-rdma/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-rdma linux-rdma/ \
	public-inbox-index linux-rdma

Example config snippet for mirrors

Newsgroup available over NNTP:

AGPL code for this site: git clone