From: Lin Yi Date: Mon, 10 Jun 2019 02:16:56 +0000 (+0800) Subject: net :sunrpc :clnt :Fix xps refcount imbalance on the error path X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=5636cbbe30c5895bc62a3fb030e9992e651141be;p=GitHub%2FLineageOS%2Fandroid_kernel_motorola_exynos9610.git 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 Signed-off-by: Anna Schumaker Signed-off-by: Sasha Levin --- diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c index 6d118357d9dc..9259529e0412 100644 --- a/net/sunrpc/clnt.c +++ b/net/sunrpc/clnt.c @@ -2706,6 +2706,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;