]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
net :sunrpc :clnt :Fix xps refcount imbalance on the error path
authorLin Yi <teroincn@163.com>
Mon, 10 Jun 2019 02:16:56 +0000 (10:16 +0800)
committerAnna Schumaker <Anna.Schumaker@Netapp.com>
Fri, 21 Jun 2019 18:43:35 +0000 (14:43 -0400)
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>
net/sunrpc/clnt.c

index 627a87a71f8ba2f90917cf5b7c0a191a476958e4..2b353472364fc61d376099148b588605c955afd9 100644 (file)
@@ -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;