aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/callback_xdr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/callback_xdr.c')
-rw-r--r--fs/nfs/callback_xdr.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
index 7c33b9a81a94..05c38cf40b69 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -330,7 +330,7 @@ static unsigned encode_op_hdr(struct xdr_stream *xdr, uint32_t op, uint32_t res)
330 330
331static unsigned encode_getattr_res(struct svc_rqst *rqstp, struct xdr_stream *xdr, const struct cb_getattrres *res) 331static unsigned encode_getattr_res(struct svc_rqst *rqstp, struct xdr_stream *xdr, const struct cb_getattrres *res)
332{ 332{
333 uint32_t *savep; 333 uint32_t *savep = NULL;
334 unsigned status = res->status; 334 unsigned status = res->status;
335 335
336 if (unlikely(status != 0)) 336 if (unlikely(status != 0))
@@ -358,23 +358,26 @@ static unsigned process_op(struct svc_rqst *rqstp,
358 struct xdr_stream *xdr_in, void *argp, 358 struct xdr_stream *xdr_in, void *argp,
359 struct xdr_stream *xdr_out, void *resp) 359 struct xdr_stream *xdr_out, void *resp)
360{ 360{
361 struct callback_op *op; 361 struct callback_op *op = &callback_ops[0];
362 unsigned int op_nr; 362 unsigned int op_nr = OP_CB_ILLEGAL;
363 unsigned int status = 0; 363 unsigned int status = 0;
364 long maxlen; 364 long maxlen;
365 unsigned res; 365 unsigned res;
366 366
367 dprintk("%s: start\n", __FUNCTION__); 367 dprintk("%s: start\n", __FUNCTION__);
368 status = decode_op_hdr(xdr_in, &op_nr); 368 status = decode_op_hdr(xdr_in, &op_nr);
369 if (unlikely(status != 0)) { 369 if (likely(status == 0)) {
370 op_nr = OP_CB_ILLEGAL; 370 switch (op_nr) {
371 op = &callback_ops[0]; 371 case OP_CB_GETATTR:
372 } else if (unlikely(op_nr != OP_CB_GETATTR && op_nr != OP_CB_RECALL)) { 372 case OP_CB_RECALL:
373 op_nr = OP_CB_ILLEGAL; 373 op = &callback_ops[op_nr];
374 op = &callback_ops[0]; 374 break;
375 status = htonl(NFS4ERR_OP_ILLEGAL); 375 default:
376 } else 376 op_nr = OP_CB_ILLEGAL;
377 op = &callback_ops[op_nr]; 377 op = &callback_ops[0];
378 status = htonl(NFS4ERR_OP_ILLEGAL);
379 }
380 }
378 381
379 maxlen = xdr_out->end - xdr_out->p; 382 maxlen = xdr_out->end - xdr_out->p;
380 if (maxlen > 0 && maxlen < PAGE_SIZE) { 383 if (maxlen > 0 && maxlen < PAGE_SIZE) {
@@ -416,6 +419,7 @@ static int nfs4_callback_compound(struct svc_rqst *rqstp, void *argp, void *resp
416 decode_compound_hdr_arg(&xdr_in, &hdr_arg); 419 decode_compound_hdr_arg(&xdr_in, &hdr_arg);
417 hdr_res.taglen = hdr_arg.taglen; 420 hdr_res.taglen = hdr_arg.taglen;
418 hdr_res.tag = hdr_arg.tag; 421 hdr_res.tag = hdr_arg.tag;
422 hdr_res.nops = NULL;
419 encode_compound_hdr_res(&xdr_out, &hdr_res); 423 encode_compound_hdr_res(&xdr_out, &hdr_res);
420 424
421 for (;;) { 425 for (;;) {