NFS4: fix cb_recallany decode error

craa_type_mask is bitmap4 per RFC5661. We need to expect a length before
extracting bitmap value.

Cc: Alexandros Batsakis <batsakis@netapp.com>
Signed-off-by: Peng Tao <peng_tao@emc.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
This commit is contained in:
Peng Tao 2011-10-23 20:22:38 -07:00 committed by Trond Myklebust
parent 92407e75ce
commit d743c3c9c2

View file

@ -488,17 +488,18 @@ static __be32 decode_recallany_args(struct svc_rqst *rqstp,
struct xdr_stream *xdr, struct xdr_stream *xdr,
struct cb_recallanyargs *args) struct cb_recallanyargs *args)
{ {
__be32 *p; uint32_t bitmap[2];
__be32 *p, status;
args->craa_addr = svc_addr(rqstp); args->craa_addr = svc_addr(rqstp);
p = read_buf(xdr, 4); p = read_buf(xdr, 4);
if (unlikely(p == NULL)) if (unlikely(p == NULL))
return htonl(NFS4ERR_BADXDR); return htonl(NFS4ERR_BADXDR);
args->craa_objs_to_keep = ntohl(*p++); args->craa_objs_to_keep = ntohl(*p++);
p = read_buf(xdr, 4); status = decode_bitmap(xdr, bitmap);
if (unlikely(p == NULL)) if (unlikely(status))
return htonl(NFS4ERR_BADXDR); return status;
args->craa_type_mask = ntohl(*p); args->craa_type_mask = bitmap[0];
return 0; return 0;
} }