Commit fdaf729d authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] kNFSd: Correct error returns.

From: NeilBrown <neilb@cse.unsw.edu.au>

Call decode_fattr on writable attributes to check for xdr errors, incorrect
utf8, etc.
parent 16df68d1
...@@ -584,8 +584,9 @@ nfsd4_verify(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_ver ...@@ -584,8 +584,9 @@ nfsd4_verify(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_ver
if ((verify->ve_bmval[0] & ~NFSD_SUPPORTED_ATTRS_WORD0) if ((verify->ve_bmval[0] & ~NFSD_SUPPORTED_ATTRS_WORD0)
|| (verify->ve_bmval[1] & ~NFSD_SUPPORTED_ATTRS_WORD1)) || (verify->ve_bmval[1] & ~NFSD_SUPPORTED_ATTRS_WORD1))
return nfserr_notsupp; return nfserr_attrnotsupp;
if (verify->ve_bmval[1] & NFSD_WRITEONLY_ATTRS_WORD1) if ((verify->ve_bmval[0] & FATTR4_WORD0_RDATTR_ERROR)
|| (verify->ve_bmval[1] & NFSD_WRITEONLY_ATTRS_WORD1))
return nfserr_inval; return nfserr_inval;
if (verify->ve_attrlen & 3) if (verify->ve_attrlen & 3)
return nfserr_inval; return nfserr_inval;
......
...@@ -908,10 +908,31 @@ nfsd4_decode_setclientid_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_s ...@@ -908,10 +908,31 @@ nfsd4_decode_setclientid_confirm(struct nfsd4_compoundargs *argp, struct nfsd4_s
static int static int
nfsd4_decode_verify(struct nfsd4_compoundargs *argp, struct nfsd4_verify *verify) nfsd4_decode_verify(struct nfsd4_compoundargs *argp, struct nfsd4_verify *verify)
{ {
#if 0
struct nfsd4_compoundargs save = {
.p = argp->p,
.end = argp->end,
.rqstp = argp->rqstp,
};
u32 ve_bmval[2];
struct iattr ve_iattr; /* request */
struct nfs4_acl *ve_acl; /* request */
#endif
DECODE_HEAD; DECODE_HEAD;
if ((status = nfsd4_decode_bitmap(argp, verify->ve_bmval))) if ((status = nfsd4_decode_bitmap(argp, verify->ve_bmval)))
goto out; goto out;
/* For convenience's sake, we compare raw xdr'd attributes in
* nfsd4_proc_verify; however we still decode here just to return
* correct error in case of bad xdr. */
#if 0
status = nfsd4_decode_fattr(ve_bmval, &ve_iattr, &ve_acl);
if (status == nfserr_inval) {
status = nfserrno(status);
goto out;
}
#endif
READ_BUF(4); READ_BUF(4);
READ32(verify->ve_attrlen); READ32(verify->ve_attrlen);
READ_BUF(verify->ve_attrlen); READ_BUF(verify->ve_attrlen);
......
...@@ -191,6 +191,7 @@ void nfsd_lockd_shutdown(void); ...@@ -191,6 +191,7 @@ void nfsd_lockd_shutdown(void);
#define nfserr_symlink __constant_htonl(NFSERR_SYMLINK) #define nfserr_symlink __constant_htonl(NFSERR_SYMLINK)
#define nfserr_not_same __constant_htonl(NFSERR_NOT_SAME) #define nfserr_not_same __constant_htonl(NFSERR_NOT_SAME)
#define nfserr_restorefh __constant_htonl(NFSERR_RESTOREFH) #define nfserr_restorefh __constant_htonl(NFSERR_RESTOREFH)
#define nfserr_attrnotsupp __constant_htonl(NFSERR_ATTRNOTSUPP)
#define nfserr_bad_xdr __constant_htonl(NFSERR_BAD_XDR) #define nfserr_bad_xdr __constant_htonl(NFSERR_BAD_XDR)
#define nfserr_openmode __constant_htonl(NFSERR_OPENMODE) #define nfserr_openmode __constant_htonl(NFSERR_OPENMODE)
......
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