aboutsummaryrefslogtreecommitdiffstats
path: root/fs
diff options
context:
space:
mode:
Diffstat (limited to 'fs')
-rw-r--r--fs/nfsd/nfs4xdr.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/fs/nfsd/nfs4xdr.c b/fs/nfsd/nfs4xdr.c
index 653951c73e31..a40bec53fa66 100644
--- a/fs/nfsd/nfs4xdr.c
+++ b/fs/nfsd/nfs4xdr.c
@@ -1039,11 +1039,21 @@ static nfsd4_dec nfsd4_dec_ops[] = {
1039 [OP_RELEASE_LOCKOWNER] (nfsd4_dec)nfsd4_decode_release_lockowner, 1039 [OP_RELEASE_LOCKOWNER] (nfsd4_dec)nfsd4_decode_release_lockowner,
1040}; 1040};
1041 1041
1042struct nfsd4_minorversion_ops {
1043 nfsd4_dec *decoders;
1044 int nops;
1045};
1046
1047static struct nfsd4_minorversion_ops nfsd4_minorversion[] = {
1048 [0] { nfsd4_dec_ops, ARRAY_SIZE(nfsd4_dec_ops) },
1049};
1050
1042static __be32 1051static __be32
1043nfsd4_decode_compound(struct nfsd4_compoundargs *argp) 1052nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
1044{ 1053{
1045 DECODE_HEAD; 1054 DECODE_HEAD;
1046 struct nfsd4_op *op; 1055 struct nfsd4_op *op;
1056 struct nfsd4_minorversion_ops *ops;
1047 int i; 1057 int i;
1048 1058
1049 /* 1059 /*
@@ -1073,9 +1083,10 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
1073 } 1083 }
1074 } 1084 }
1075 1085
1076 if (argp->minorversion != 0) 1086 if (argp->minorversion >= ARRAY_SIZE(nfsd4_minorversion))
1077 argp->opcnt = 0; 1087 argp->opcnt = 0;
1078 1088
1089 ops = &nfsd4_minorversion[argp->minorversion];
1079 for (i = 0; i < argp->opcnt; i++) { 1090 for (i = 0; i < argp->opcnt; i++) {
1080 op = &argp->ops[i]; 1091 op = &argp->ops[i];
1081 op->replay = NULL; 1092 op->replay = NULL;
@@ -1113,8 +1124,8 @@ nfsd4_decode_compound(struct nfsd4_compoundargs *argp)
1113 } 1124 }
1114 op->opnum = ntohl(*argp->p++); 1125 op->opnum = ntohl(*argp->p++);
1115 1126
1116 if (op->opnum >= OP_ACCESS && op->opnum < ARRAY_SIZE(nfsd4_dec_ops)) 1127 if (op->opnum >= OP_ACCESS && op->opnum < ops->nops)
1117 op->status = nfsd4_dec_ops[op->opnum](argp, &op->u); 1128 op->status = ops->decoders[op->opnum](argp, &op->u);
1118 else { 1129 else {
1119 op->opnum = OP_ILLEGAL; 1130 op->opnum = OP_ILLEGAL;
1120 op->status = nfserr_op_illegal; 1131 op->status = nfserr_op_illegal;