Skip to contentSkip to conversation

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

PATCH New Lin Yi 1 participant 1 message Jun 10, 2019

Subsystems (3)
lore
Share & tools
lore

Lin Yi

author
#0 lore raw

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

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.

---
 net/sunrpc/clnt.c | 1 +
 1 file changed, 1 insertion(+)
net/sunrpc/clnt.c +1 -0
index 627a87a..2b35347 100644
@@ -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;
Signature · 1 line
1.9.1