Skip to content

Commit 1208fd5

Browse files
author
J. Bruce Fields
committed
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>
1 parent eee9301 commit 1208fd5

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

net/sunrpc/clnt.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -453,9 +453,10 @@ struct rpc_clnt *rpc_create_xprt(struct rpc_create_args *args,
453453
struct rpc_xprt_switch *xps;
454454

455455
xps = xprt_switch_alloc(xprt, GFP_KERNEL);
456-
if (xps == NULL)
456+
if (xps == NULL) {
457+
xprt_put(xprt);
457458
return ERR_PTR(-ENOMEM);
458-
459+
}
459460
clnt = rpc_new_client(args, xps, xprt, NULL);
460461
if (IS_ERR(clnt))
461462
return clnt;

0 commit comments

Comments
 (0)