Commit c80650bd authored by Trond Myklebust's avatar Trond Myklebust

NFSv4: NFSv4 errors in nfs4_init_client() must not leak to userland

 Fixes a potential Oops at mount time.
Signed-off-by: default avatarTrond Myklebust <Trond.Myklebust@netapp.com>
parent cdb9095c
......@@ -65,10 +65,10 @@ extern struct rpc_procinfo nfs4_procedures[];
extern nfs4_stateid zero_stateid;
/* Prevent leaks of NFSv4 errors into userland */
static inline int nfs4_map_errors(int err)
int nfs4_map_errors(int err)
{
if (err < -1000) {
printk(KERN_WARNING "%s could not handle NFSv4 error %d\n",
dprintk("%s could not handle NFSv4 error %d\n",
__FUNCTION__, -err);
return -EIO;
}
......
......@@ -206,7 +206,7 @@ nfs4_put_client(struct nfs4_client *clp)
nfs4_free_client(clp);
}
int nfs4_init_client(struct nfs4_client *clp)
static int __nfs4_init_client(struct nfs4_client *clp)
{
int status = nfs4_proc_setclientid(clp, NFS4_CALLBACK, nfs_callback_tcpport);
if (status == 0)
......@@ -216,6 +216,11 @@ int nfs4_init_client(struct nfs4_client *clp)
return status;
}
int nfs4_init_client(struct nfs4_client *clp)
{
return nfs4_map_errors(__nfs4_init_client(clp));
}
u32
nfs4_alloc_lockowner_id(struct nfs4_client *clp)
{
......@@ -859,7 +864,7 @@ static int reclaimer(void *ptr)
status = nfs4_proc_renew(clp);
if (status == 0 || status == -NFS4ERR_CB_PATH_DOWN)
goto out;
status = nfs4_init_client(clp);
status = __nfs4_init_client(clp);
if (status)
goto out_error;
/* Mark all delagations for reclaim */
......
......@@ -677,6 +677,7 @@ extern struct dentry_operations nfs4_dentry_operations;
extern struct inode_operations nfs4_dir_inode_operations;
/* nfs4proc.c */
extern int nfs4_map_errors(int err);
extern int nfs4_proc_setclientid(struct nfs4_client *, u32, unsigned short);
extern int nfs4_proc_setclientid_confirm(struct nfs4_client *);
extern int nfs4_open_reclaim(struct nfs4_state_owner *, struct nfs4_state *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment