From: Weston Andros Adamson <dros@netapp.com>
To: Trond.Myklebust@netapp.com
Cc: linux-nfs@vger.kernel.org, Weston Andros Adamson <dros@netapp.com>
Subject: [PATCH 2/3] NFSv4: fix server_scope memory leak
Date: Fri, 17 Feb 2012 15:20:25 -0500 [thread overview]
Message-ID: <1329510026-30403-2-git-send-email-dros@netapp.com> (raw)
In-Reply-To: <1329510026-30403-1-git-send-email-dros@netapp.com>
server_scope would never be freed if nfs4_check_cl_exchange_flags() returned
non-zero
Signed-off-by: Weston Andros Adamson <dros@netapp.com>
---
This should be pushed to stable@vger.kernel.org
fs/nfs/nfs4proc.c | 15 +++++++++------
1 files changed, 9 insertions(+), 6 deletions(-)
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c
index 87c584d..20c3bb0 100644
--- a/fs/nfs/nfs4proc.c
+++ b/fs/nfs/nfs4proc.c
@@ -4945,8 +4945,10 @@ int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred)
clp->cl_rpcclient->cl_auth->au_flavor);
res.server_scope = kzalloc(sizeof(struct server_scope), GFP_KERNEL);
- if (unlikely(!res.server_scope))
- return -ENOMEM;
+ if (unlikely(!res.server_scope)) {
+ status = -ENOMEM;
+ goto out;
+ }
status = rpc_call_sync(clp->cl_rpcclient, &msg, RPC_TASK_TIMEOUT);
if (!status)
@@ -4963,12 +4965,13 @@ int nfs4_proc_exchange_id(struct nfs_client *clp, struct rpc_cred *cred)
clp->server_scope = NULL;
}
- if (!clp->server_scope)
+ if (!clp->server_scope) {
clp->server_scope = res.server_scope;
- else
- kfree(res.server_scope);
+ goto out;
+ }
}
-
+ kfree(res.server_scope);
+out:
dprintk("<-- %s status= %d\n", __func__, status);
return status;
}
--
1.7.4.4
next prev parent reply other threads:[~2012-02-17 20:20 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-17 20:20 [PATCH 1/3] NFSv4: Send implementation id with exchange_id Weston Andros Adamson
2012-02-17 20:20 ` Weston Andros Adamson [this message]
2012-02-17 20:20 ` [PATCH 3/3] NFSv4: parse and display server implementation ids Weston Andros Adamson
2012-03-03 14:09 ` Bryan Schumaker
2012-03-04 23:33 ` Myklebust, Trond
2012-03-06 17:08 ` Adamson, Dros
2012-03-06 17:12 ` Myklebust, Trond
2012-03-06 17:15 ` Bryan Schumaker
-- strict thread matches above, loose matches on Subject: below --
2012-02-16 16:17 [PATCH 1/3] NFSv4: Send implementation id with exchange_id Weston Andros Adamson
2012-02-16 16:17 ` [PATCH 2/3] NFSv4: fix server_scope memory leak Weston Andros Adamson
2012-02-16 20:43 ` Myklebust, Trond
2012-02-16 20:44 ` Adamson, Dros
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=1329510026-30403-2-git-send-email-dros@netapp.com \
--to=dros@netapp.com \
--cc=Trond.Myklebust@netapp.com \
--cc=linux-nfs@vger.kernel.org \
/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).