summaryrefslogtreecommitdiffstats
path: root/net/sunrpc
diff options
context:
space:
mode:
authorLin Yi <teroincn@163.com>2019-06-10 10:16:56 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-07-14 08:11:15 +0200
commite9f76b954336435243ef100e8c8ca20278f9feca (patch)
tree5b990112f5dfe30b2e1d81a55ab37c3e2f1de2db /net/sunrpc
parent810cfc3d9d2e4b345ba7e5d6290b00562e9e0d27 (diff)
downloadlinux-stable-e9f76b954336435243ef100e8c8ca20278f9feca.tar.gz
linux-stable-e9f76b954336435243ef100e8c8ca20278f9feca.tar.bz2
linux-stable-e9f76b954336435243ef100e8c8ca20278f9feca.zip
net :sunrpc :clnt :Fix xps refcount imbalance on the error path
[ Upstream commit b96226148491505318228ac52624956bd98f9e0c ] 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> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net/sunrpc')
-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 7e4553dbc3c7..0d7d149b1b1b 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -2713,6 +2713,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;