NFSD: Remove argument length checking in nfsd_dispatch()
[ Upstream commit 5650682e16f41722f735b7beeb2dbc3411dfbeb6 ] Now that the argument decoders for NFSv2 and NFSv3 use the xdr_stream mechanism, the version-specific length checking logic in nfsd_dispatch() is no longer necessary. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
7e6746027b
commit
e440613886
@@ -988,37 +988,6 @@ out:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* A write procedure can have a large argument, and a read procedure can
|
|
||||||
* have a large reply, but no NFSv2 or NFSv3 procedure has argument and
|
|
||||||
* reply that can both be larger than a page. The xdr code has taken
|
|
||||||
* advantage of this assumption to be a sloppy about bounds checking in
|
|
||||||
* some cases. Pending a rewrite of the NFSv2/v3 xdr code to fix that
|
|
||||||
* problem, we enforce these assumptions here:
|
|
||||||
*/
|
|
||||||
static bool nfs_request_too_big(struct svc_rqst *rqstp,
|
|
||||||
const struct svc_procedure *proc)
|
|
||||||
{
|
|
||||||
/*
|
|
||||||
* The ACL code has more careful bounds-checking and is not
|
|
||||||
* susceptible to this problem:
|
|
||||||
*/
|
|
||||||
if (rqstp->rq_prog != NFS_PROGRAM)
|
|
||||||
return false;
|
|
||||||
/*
|
|
||||||
* Ditto NFSv4 (which can in theory have argument and reply both
|
|
||||||
* more than a page):
|
|
||||||
*/
|
|
||||||
if (rqstp->rq_vers >= 4)
|
|
||||||
return false;
|
|
||||||
/* The reply will be small, we're OK: */
|
|
||||||
if (proc->pc_xdrressize > 0 &&
|
|
||||||
proc->pc_xdrressize < XDR_QUADLEN(PAGE_SIZE))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
return rqstp->rq_arg.len > PAGE_SIZE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* nfsd_dispatch - Process an NFS or NFSACL Request
|
* nfsd_dispatch - Process an NFS or NFSACL Request
|
||||||
* @rqstp: incoming request
|
* @rqstp: incoming request
|
||||||
@@ -1037,9 +1006,6 @@ int nfsd_dispatch(struct svc_rqst *rqstp, __be32 *statp)
|
|||||||
struct kvec *resv = &rqstp->rq_res.head[0];
|
struct kvec *resv = &rqstp->rq_res.head[0];
|
||||||
__be32 *p;
|
__be32 *p;
|
||||||
|
|
||||||
if (nfs_request_too_big(rqstp, proc))
|
|
||||||
goto out_decode_err;
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Give the xdr decoder a chance to change this if it wants
|
* Give the xdr decoder a chance to change this if it wants
|
||||||
* (necessary in the NFSv4.0 compound case)
|
* (necessary in the NFSv4.0 compound case)
|
||||||
|
Reference in New Issue
Block a user