From: "J. Bruce Fields" <bfields@redhat.com>
To: Trond Myklebust <trond.myklebust@primarydata.com>,
Anna Schumaker <schumakeranna@gmail.com>
Cc: linux-nfs@vger.kernel.org, "J. Bruce Fields" <bfields@redhat.com>
Subject: [PATCH 1/3] SUNRPC: fix xprt leak on xps allocation failure
Date: Tue, 24 May 2016 17:16:14 -0400 [thread overview]
Message-ID: <1464124576-27467-2-git-send-email-bfields@redhat.com> (raw)
In-Reply-To: <1464124576-27467-1-git-send-email-bfields@redhat.com>
From: "J. Bruce Fields" <bfields@redhat.com>
Callers of rpc_create_xprt expect it to put the xprt on success and
failure.
Signed-off-by: J. Bruce Fields <bfields@redhat.com>
---
net/sunrpc/clnt.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
Alternatively, maybe we should just change that convention and leave it
to callers to put the xprt on failure?
diff --git a/net/sunrpc/clnt.c b/net/sunrpc/clnt.c
index 7e0c9bf22df8..a87e29ac993e 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;
--
2.5.5
next prev parent reply other threads:[~2016-05-24 21:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-24 21:16 [PATCH 0/3] fix backchannel crash due to multipath J. Bruce Fields
2016-05-24 21:16 ` J. Bruce Fields [this message]
2016-05-24 21:16 ` [PATCH 2/3] nfsd4/rpc: move backchannel create logic into rpc code J. Bruce Fields
2016-05-24 21:16 ` [PATCH 3/3] rpc: share one xps between all backchannels J. Bruce Fields
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1464124576-27467-2-git-send-email-bfields@redhat.com \
--to=bfields@redhat.com \
--cc=linux-nfs@vger.kernel.org \
--cc=schumakeranna@gmail.com \
--cc=trond.myklebust@primarydata.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).