diff mbox series

net :sunrpc :clnt :Fix xps refcount imbalance on the error path

Message ID 20190610021655.GA14779@163.com (mailing list archive)
State New, archived
Headers show
Series net :sunrpc :clnt :Fix xps refcount imbalance on the error path | expand

Commit Message

Nil Yi June 10, 2019, 2:16 a.m. UTC
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 mbox series

Patch

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;