aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfsd/nfs4state.c
diff options
context:
space:
mode:
authorJ. Bruce Fields <bfields@redhat.com>2011-10-10 15:07:40 -0400
committerJ. Bruce Fields <bfields@redhat.com>2011-10-11 12:15:01 -0400
commita084daf512bb66fa3c8e21c7027daea521179cd0 (patch)
treeae3432178013d3b474adac890dad3fb7262f9746 /fs/nfsd/nfs4state.c
parent04f9e664b21c4440daf4d08f31db9b18517e4b8d (diff)
nfsd4: move name-length checks to xdr
Again, these checks are better in the xdr code. Signed-off-by: J. Bruce Fields <bfields@redhat.com>
Diffstat (limited to 'fs/nfsd/nfs4state.c')
-rw-r--r--fs/nfsd/nfs4state.c24
1 files changed, 2 insertions, 22 deletions
diff --git a/fs/nfsd/nfs4state.c b/fs/nfsd/nfs4state.c
index 6bfa293e1c91..5f35f35a2da0 100644
--- a/fs/nfsd/nfs4state.c
+++ b/fs/nfsd/nfs4state.c
@@ -1189,17 +1189,6 @@ static struct nfs4_client *create_client(struct xdr_netobj name, char *recdir,
1189 return clp; 1189 return clp;
1190} 1190}
1191 1191
1192static int check_name(struct xdr_netobj name)
1193{
1194 if (name.len == 0)
1195 return 0;
1196 if (name.len > NFS4_OPAQUE_LIMIT) {
1197 dprintk("NFSD: check_name: name too long(%d)!\n", name.len);
1198 return 0;
1199 }
1200 return 1;
1201}
1202
1203static void 1192static void
1204add_to_unconfirmed(struct nfs4_client *clp, unsigned int strhashval) 1193add_to_unconfirmed(struct nfs4_client *clp, unsigned int strhashval)
1205{ 1194{
@@ -1442,7 +1431,7 @@ nfsd4_exchange_id(struct svc_rqst *rqstp,
1442 __func__, rqstp, exid, exid->clname.len, exid->clname.data, 1431 __func__, rqstp, exid, exid->clname.len, exid->clname.data,
1443 addr_str, exid->flags, exid->spa_how); 1432 addr_str, exid->flags, exid->spa_how);
1444 1433
1445 if (!check_name(exid->clname) || (exid->flags & ~EXCHGID4_FLAG_MASK_A)) 1434 if (exid->flags & ~EXCHGID4_FLAG_MASK_A)
1446 return nfserr_inval; 1435 return nfserr_inval;
1447 1436
1448 /* Currently only support SP4_NONE */ 1437 /* Currently only support SP4_NONE */
@@ -1992,19 +1981,13 @@ __be32
1992nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate, 1981nfsd4_setclientid(struct svc_rqst *rqstp, struct nfsd4_compound_state *cstate,
1993 struct nfsd4_setclientid *setclid) 1982 struct nfsd4_setclientid *setclid)
1994{ 1983{
1995 struct xdr_netobj clname = { 1984 struct xdr_netobj clname = setclid->se_name;
1996 .len = setclid->se_namelen,
1997 .data = setclid->se_name,
1998 };
1999 nfs4_verifier clverifier = setclid->se_verf; 1985 nfs4_verifier clverifier = setclid->se_verf;
2000 unsigned int strhashval; 1986 unsigned int strhashval;
2001 struct nfs4_client *conf, *unconf, *new; 1987 struct nfs4_client *conf, *unconf, *new;
2002 __be32 status; 1988 __be32 status;
2003 char dname[HEXDIR_LEN]; 1989 char dname[HEXDIR_LEN];
2004 1990
2005 if (!check_name(clname))
2006 return nfserr_inval;
2007
2008 status = nfs4_make_rec_clidname(dname, &clname); 1991 status = nfs4_make_rec_clidname(dname, &clname);
2009 if (status) 1992 if (status)
2010 return status; 1993 return status;
@@ -2523,9 +2506,6 @@ nfsd4_process_open1(struct nfsd4_compound_state *cstate,
2523 struct nfs4_openowner *oo = NULL; 2506 struct nfs4_openowner *oo = NULL;
2524 __be32 status; 2507 __be32 status;
2525 2508
2526 if (!check_name(open->op_owner))
2527 return nfserr_inval;
2528
2529 if (STALE_CLIENTID(&open->op_clientid)) 2509 if (STALE_CLIENTID(&open->op_clientid))
2530 return nfserr_stale_clientid; 2510 return nfserr_stale_clientid;
2531 2511