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
30713071 nfs4_proc_lookup_mountpoint(struct inode *dir, struct qstr *name,
30723072 struct nfs_fh *fhandle, struct nfs_fattr *fattr)
30733073 {
3074+ struct rpc_clnt *client = NFS_CLIENT(dir);
30743075 int status;
3075− struct rpc_clnt *client = rpc_clone_client(NFS_CLIENT(dir));
30763076
30773077 status = nfs4_proc_lookup_common(&client, dir, name, fhandle, fattr, NULL);
3078− if (status < 0) {
3079− rpc_shutdown_client(client);
3078+ if (status < 0)
30803079 return ERR_PTR(status);
3081− }
3082− return client;
3080+ return (client == NFS_CLIENT(dir)) ? rpc_clone_client(client) : client;
30833081 }
30843082
30853083 static 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