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

[PATCH] kNFSd: add OP_ILLEGAL, and fix processing of compounds with out of bounds op numbers.

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

add OP_ILLEGAL, and fix processing of compounds with out of bounds op
numbers.
parent b0ac617e
......@@ -1078,6 +1078,13 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
op->opnum = ntohl(*argp->p++);
switch (op->opnum) {
case 2: /* Reserved operation */
op->opnum = OP_ILLEGAL;
if (argp->minorversion == 0)
op->status = nfserr_op_illegal;
else
op->status = nfserr_minor_vers_mismatch;
break;
case OP_ACCESS:
op->status = nfsd4_decode_access(argp, &op->u.access);
break;
......@@ -1175,13 +1182,8 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
op->status = nfsd4_decode_release_lockowner(argp, &op->u.release_lockowner);
break;
default:
/*
* According to spec, anything greater than OP_WRITE
* is treated as OP_WRITE+1 in the response.
*/
if (op->opnum > OP_WRITE)
op->opnum = OP_WRITE + 1;
op->status = nfserr_notsupp;
op->opnum = OP_ILLEGAL;
op->status = nfserr_op_illegal;
break;
}
......
......@@ -87,6 +87,7 @@ enum nfs_opnum4 {
OP_VERIFY = 37,
OP_WRITE = 38,
OP_RELEASE_LOCKOWNER = 39,
OP_ILLEGAL = 10044,
};
enum nfsstat4 {
......
......@@ -195,6 +195,7 @@ void nfsd_lockd_shutdown(void);
#define nfserr_bad_xdr __constant_htonl(NFSERR_BAD_XDR)
#define nfserr_openmode __constant_htonl(NFSERR_OPENMODE)
#define nfserr_locks_held __constant_htonl(NFSERR_LOCKS_HELD)
#define nfserr_op_illegal __constant_htonl(NFSERR_OP_ILLEGAL)
/* error codes for internal use */
/* if a request fails due to kmalloc failure, it gets dropped.
......
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