diff options
author | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-08-07 20:38:07 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2013-08-07 20:47:26 -0400 |
commit | b72888cb0ba63b2dfc6c8d3cd78a7fea584bebc6 (patch) | |
tree | ca1ea405e0d79734771a2a7861b7f363568ac56e | |
parent | eddffa40841c0249678ee5551839e369baa97314 (diff) |
NFSv4: Fix up nfs4_proc_lookup_mountpoint
Currently, we do not check the return value of client = rpc_clone_client(),
nor do we shut down the resulting cloned rpc_clnt in the case where a
NFS4ERR_WRONGSEC has caused nfs4_proc_lookup_common() to replace the
original value of 'client' (causing a memory leak).
Fix both issues and simplify the code by moving the call to
rpc_clone_client() until after nfs4_proc_lookup_common() has
done its business.
Reported-by: Andy Adamson <andros@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
-rw-r--r-- | fs/nfs/nfs4proc.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/fs/nfs/nfs4proc.c b/fs/nfs/nfs4proc.c index cf11799297c4..108a774095f7 100644 --- a/fs/nfs/nfs4proc.c +++ b/fs/nfs/nfs4proc.c | |||
@@ -3071,15 +3071,13 @@ struct rpc_clnt * | |||
3071 | nfs4_proc_lookup_mountpoint(struct inode *dir, struct qstr *name, | 3071 | nfs4_proc_lookup_mountpoint(struct inode *dir, struct qstr *name, |
3072 | struct nfs_fh *fhandle, struct nfs_fattr *fattr) | 3072 | struct nfs_fh *fhandle, struct nfs_fattr *fattr) |
3073 | { | 3073 | { |
3074 | struct rpc_clnt *client = NFS_CLIENT(dir); | ||
3074 | int status; | 3075 | int status; |
3075 | struct rpc_clnt *client = rpc_clone_client(NFS_CLIENT(dir)); | ||
3076 | 3076 | ||
3077 | status = nfs4_proc_lookup_common(&client, dir, name, fhandle, fattr, NULL); | 3077 | status = nfs4_proc_lookup_common(&client, dir, name, fhandle, fattr, NULL); |
3078 | if (status < 0) { | 3078 | if (status < 0) |
3079 | rpc_shutdown_client(client); | ||
3080 | return ERR_PTR(status); | 3079 | return ERR_PTR(status); |
3081 | } | 3080 | return (client == NFS_CLIENT(dir)) ? rpc_clone_client(client) : client; |
3082 | return client; | ||
3083 | } | 3081 | } |
3084 | 3082 | ||
3085 | static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry) | 3083 | static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry) |