summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2016-05-20 17:07:17 -0400
committerJ. Bruce Fields <bfields@redhat.com>2016-06-15 10:32:25 -0400
commit1208fd569c07ab84aa5d024abd863267c2953b4a (patch)
tree39fccf3a8cd1e2d9af0c9f1321436952e12ec80b /net
parenteee930163c6a2507aa3b41edf8f7e3b7a2049769 (diff)
downloadlinux-1208fd569c07ab84aa5d024abd863267c2953b4a.tar.gz
SUNRPC: fix xprt leak on xps allocation failure
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>
Diffstat (limited to 'net')
-rw-r--r--net/sunrpc/clnt.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 06b4df9faaa1..173c5dd2d751 100644
--- a/net/sunrpc/clnt.c
+++ b/net/sunrpc/clnt.c
@@ -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;