linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net :sunrpc :clnt :Fix xps refcount imbalance on the error path
@ 2019-06-10  2:16 Lin Yi
  0 siblings, 0 replies; only message in thread
From: Lin Yi @ 2019-06-10  2:16 UTC (permalink / raw)
  To: trond.myklebust, anna.schumaker
  Cc: linux-nfs, liujian6, csong, zhiyunq, yiqiuping, teroincn

rpc_clnt_add_xprt take a reference to struct rpc_xprt_switch, but forget
to release it before return, may lead to a memory leak.

Signed-off-by: Lin Yi <teroincn@163.com>
---
 net/sunrpc/clnt.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 627a87a..2b35347 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -2805,6 +2805,7 @@ int rpc_clnt_add_xprt(struct rpc_clnt *clnt,
 	xprt = xprt_iter_xprt(&clnt->cl_xpi);
 	if (xps == NULL || xprt == NULL) {
 		rcu_read_unlock();
+		xprt_switch_put(xps);
 		return -EAGAIN;
 	}
 	resvport = xprt->resvport;
-- 
1.9.1



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2019-06-10  2:17 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-10  2:16 [PATCH] net :sunrpc :clnt :Fix xps refcount imbalance on the error path Lin Yi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).