Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b72888cb authored by Trond Myklebust's avatar Trond Myklebust
Browse files

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: default avatarAndy Adamson <andros@netapp.com>
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent eddffa40
Loading
Loading
Loading
Loading
+3 −5
Original line number Original line Diff line number Diff line
@@ -3071,15 +3071,13 @@ struct rpc_clnt *
nfs4_proc_lookup_mountpoint(struct inode *dir, struct qstr *name,
nfs4_proc_lookup_mountpoint(struct inode *dir, struct qstr *name,
			    struct nfs_fh *fhandle, struct nfs_fattr *fattr)
			    struct nfs_fh *fhandle, struct nfs_fattr *fattr)
{
{
	struct rpc_clnt *client = NFS_CLIENT(dir);
	int status;
	int status;
	struct rpc_clnt *client = rpc_clone_client(NFS_CLIENT(dir));


	status = nfs4_proc_lookup_common(&client, dir, name, fhandle, fattr, NULL);
	status = nfs4_proc_lookup_common(&client, dir, name, fhandle, fattr, NULL);
	if (status < 0) {
	if (status < 0)
		rpc_shutdown_client(client);
		return ERR_PTR(status);
		return ERR_PTR(status);
	}
	return (client == NFS_CLIENT(dir)) ? rpc_clone_client(client) : client;
	return client;
}
}


static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry)
static int _nfs4_proc_access(struct inode *inode, struct nfs_access_entry *entry)