Commit 15a094e2 authored by Kendrick M. Smith's avatar Kendrick M. Smith Committed by Linus Torvalds

[PATCH] kNFSd: NFSv4: overflow check in nfsd_commit()

Sanity check COMMIT arguments by ensuring that (start)+(length) < 2^64.
The check is done in a way which is free of signedness pathologies in
all cases.

This change was inspired by pynfs, Peter Astrand's regression testsuite
for NFSv4 servers.  The change is necessary for all of the COMMIT tests
to pass.  However, it's a little open to debate whether the change is
really needed.  I'm curious to hear the opinions of other developers.
parent 7aefa9c7
......@@ -756,6 +756,9 @@ nfsd_commit(struct svc_rqst *rqstp, struct svc_fh *fhp,
struct file file;
int err;
if ((u64)count > ~(u64)offset)
return nfserr_inval;
if ((err = nfsd_open(rqstp, fhp, S_IFREG, MAY_WRITE, &file)) != 0)
return err;
if (EX_ISSYNC(fhp->fh_export)) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment