History

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.

Trond Myklebust committed 13 years ago

Commit b72888c1 parent eddffa41 file · +3 −5Browse files

Unified · Split

fs/nfs/nfs4proc.c+3−5
@@ -3071,15 +3071,13 @@ struct rpc_clnt * · 3070 unmodified lines
3071nfs4_proc_lookup_mountpoint(struct inode *dir, struct qstr *name,3071nfs4_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
3085static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry)3083static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry)

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t