]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/blob - releases/4.6.5/sunrpc-fix-xprt-leak-on-xps-allocation-failure.patch
5.1-stable patches
[thirdparty/kernel/stable-queue.git] / releases / 4.6.5 / sunrpc-fix-xprt-leak-on-xps-allocation-failure.patch
1 From 1208fd569c07ab84aa5d024abd863267c2953b4a Mon Sep 17 00:00:00 2001
2 From: "J. Bruce Fields" <bfields@redhat.com>
3 Date: Fri, 20 May 2016 17:07:17 -0400
4 Subject: SUNRPC: fix xprt leak on xps allocation failure
5
6 From: J. Bruce Fields <bfields@redhat.com>
7
8 commit 1208fd569c07ab84aa5d024abd863267c2953b4a upstream.
9
10 Callers of rpc_create_xprt expect it to put the xprt on success and
11 failure.
12
13 Signed-off-by: J. Bruce Fields <bfields@redhat.com>
14 Acked-by: Trond Myklebust <trondmy@primarydata.com>
15 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
16
17 ---
18 net/sunrpc/clnt.c | 5 +++--
19 1 file changed, 3 insertions(+), 2 deletions(-)
20
21 --- a/net/sunrpc/clnt.c
22 +++ b/net/sunrpc/clnt.c
23 @@ -453,9 +453,10 @@ static struct rpc_clnt *rpc_create_xprt(
24 struct rpc_xprt_switch *xps;
25
26 xps = xprt_switch_alloc(xprt, GFP_KERNEL);
27 - if (xps == NULL)
28 + if (xps == NULL) {
29 + xprt_put(xprt);
30 return ERR_PTR(-ENOMEM);
31 -
32 + }
33 clnt = rpc_new_client(args, xps, xprt, NULL);
34 if (IS_ERR(clnt))
35 return clnt;