summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorLin Yi <teroincn@163.com>2019-06-10 04:16:56 +0200
committerAnna Schumaker <Anna.Schumaker@Netapp.com>2019-06-21 20:43:35 +0200
commitb96226148491505318228ac52624956bd98f9e0c (patch)
tree4f798ec59c449c5764a1cbc28c15f1faf9077eca /net
parentNFS4: Only set creation opendata if O_CREAT (diff)
downloadlinux-b96226148491505318228ac52624956bd98f9e0c.tar.xz
linux-b96226148491505318228ac52624956bd98f9e0c.zip
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. Signed-off-by: Lin Yi <teroincn@163.com> Signed-off-by: Anna Schumaker <Anna.Schumaker@Netapp.com>
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/clnt.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 627a87a71f8b..2b353472364f 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;