forked from Minki/linux
nfsd: fix encode_entryplus_baggage stack usage
We stick an extra svc_fh in nfsd3_readdirres to save the need to kmalloc, though maybe it would be fine to kmalloc instead. Acked-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: J. Bruce Fields <bfields@redhat.com>
This commit is contained in:
parent
3554116d3a
commit
068c34c0ce
@ -842,21 +842,21 @@ out:
|
|||||||
|
|
||||||
static __be32 *encode_entryplus_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name, int namlen)
|
static __be32 *encode_entryplus_baggage(struct nfsd3_readdirres *cd, __be32 *p, const char *name, int namlen)
|
||||||
{
|
{
|
||||||
struct svc_fh fh;
|
struct svc_fh *fh = &cd->scratch;
|
||||||
__be32 err;
|
__be32 err;
|
||||||
|
|
||||||
fh_init(&fh, NFS3_FHSIZE);
|
fh_init(fh, NFS3_FHSIZE);
|
||||||
err = compose_entry_fh(cd, &fh, name, namlen);
|
err = compose_entry_fh(cd, fh, name, namlen);
|
||||||
if (err) {
|
if (err) {
|
||||||
*p++ = 0;
|
*p++ = 0;
|
||||||
*p++ = 0;
|
*p++ = 0;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
p = encode_post_op_attr(cd->rqstp, p, &fh);
|
p = encode_post_op_attr(cd->rqstp, p, fh);
|
||||||
*p++ = xdr_one; /* yes, a file handle follows */
|
*p++ = xdr_one; /* yes, a file handle follows */
|
||||||
p = encode_fh(p, &fh);
|
p = encode_fh(p, fh);
|
||||||
out:
|
out:
|
||||||
fh_put(&fh);
|
fh_put(fh);
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,6 +174,9 @@ struct nfsd3_linkres {
|
|||||||
struct nfsd3_readdirres {
|
struct nfsd3_readdirres {
|
||||||
__be32 status;
|
__be32 status;
|
||||||
struct svc_fh fh;
|
struct svc_fh fh;
|
||||||
|
/* Just to save kmalloc on every readdirplus entry (svc_fh is a
|
||||||
|
* little large for the stack): */
|
||||||
|
struct svc_fh scratch;
|
||||||
int count;
|
int count;
|
||||||
__be32 verf[2];
|
__be32 verf[2];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user