2005-04-20 18:36:09

by Steven Procter

[permalink] [raw]
Subject: Re: NFS crash problem in readdirplus

Right, resp->buffer is set here;

int
nfs3svc_decode_readdirplusargs(struct svc_rqst *rqstp, u32 *p,
struct nfsd3_readdirargs *args)
{
int len, pn;

if (!(p = decode_fh(p, &args->fh)))
return 0;
p = xdr_decode_hyper(p, &args->cookie);
args->verf = p; p += 2;
args->dircount = ntohl(*p++);
args->count = ntohl(*p++);

len = (args->count > NFSSVC_MAXBLKSIZE) ? NFSSVC_MAXBLKSIZE :
args->count;
args->count = len;

while (len > 0) {
pn = rqstp->rq_resused;
svc_take_page(rqstp);
if (!args->buffer)
here --> args->buffer = page_address(rqstp->rq_respages[pn]);
len -= PAGE_SIZE;
}

return xdr_argsize_check(rqstp, p);
}

If len == 0 then the conditional on that loop never holds and
args->buffer is never set.

I think that a maxcount of 0 is an invalid argument. The rfc says that
the size must include all XDR overhead so there is no way to reply
successfully when maxcount is 0.

--Steven



-------------------------------------------------------
This SF.Net email is sponsored by: New Crystal Reports XI.
Version 11 adds new functionality designed to reduce time involved in
creating, integrating, and deploying reporting solutions. Free runtime info,
new features, or free trial, at: http://www.businessobjects.com/devxi/728
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs


2005-04-20 20:10:26

by Trond Myklebust

[permalink] [raw]
Subject: Re: NFS crash problem in readdirplus

on den 20.04.2005 Klokka 11:34 (-0700) skreiv Steven:

> I think that a maxcount of 0 is an invalid argument. The rfc says that
> the size must include all XDR overhead so there is no way to reply
> successfully when maxcount is 0.

Note that _strictly_ speaking, maxcount gives the maximum size for the
entire READDIRPLUS3resok structure (including post_op attr and cookie
verifier).
This is something we appear to have overlooked in both the client and
server and applies to READDIR too. It also applies to NFSv4.

Cheers,
Trond
--
Trond Myklebust <[email protected]>



-------------------------------------------------------
This SF.Net email is sponsored by: New Crystal Reports XI.
Version 11 adds new functionality designed to reduce time involved in
creating, integrating, and deploying reporting solutions. Free runtime info,
new features, or free trial, at: http://www.businessobjects.com/devxi/728
_______________________________________________
NFS maillist - [email protected]
https://lists.sourceforge.net/lists/listinfo/nfs