]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
SUNRPC: fix xprt leak on xps allocation failure
authorJ. Bruce Fields <bfields@redhat.com>
Fri, 20 May 2016 21:07:17 +0000 (17:07 -0400)
committerJ. Bruce Fields <bfields@redhat.com>
Wed, 15 Jun 2016 14:32:25 +0000 (10:32 -0400)
Callers of rpc_create_xprt expect it to put the xprt on success and
failure.

Cc: stable@vger.kernel.org
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Acked-by: Trond Myklebust <trondmy@primarydata.com>
net/sunrpc/clnt.c

index 06b4df9faaa1696b1e21ead9ddacea85cf41f760..173c5dd2d751ea59bddbea61922bea0d4ff0594d 100644 (file)
@@ -453,9 +453,10 @@ struct rpc_clnt *rpc_create_xprt(struct rpc_create_args *args,
        struct rpc_xprt_switch *xps;
 
        xps = xprt_switch_alloc(xprt, GFP_KERNEL);
-       if (xps == NULL)
+       if (xps == NULL) {
+               xprt_put(xprt);
                return ERR_PTR(-ENOMEM);
-
+       }
        clnt = rpc_new_client(args, xps, xprt, NULL);
        if (IS_ERR(clnt))
                return clnt;