The NFSv2/NFSv3 server does not handle zero length WRITE requests correctly
authorPeter Staubach <staubach@redhat.com>
Wed, 9 May 2007 09:34:48 +0000 (02:34 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Wed, 9 May 2007 19:30:54 +0000 (12:30 -0700)
commitf34b95689d2ce001c157b1604289ff240b4bdee0
treee249e166e3c66656ad1b5ac895da6e4c207830e1
parent8842c9655b2b7f0e8e6c50a773b649e5d8a57678
The NFSv2/NFSv3 server does not handle zero length WRITE requests correctly

The NFSv2 and NFSv3 servers do not handle WRITE requests for 0 bytes
correctly.  The specifications indicate that the server should accept the
request, but it should mostly turn into a no-op.  Currently, the server
will return an XDR decode error, which it should not.

Attached is a patch which addresses this issue.  It also adds some boundary
checking to ensure that the request contains as much data as was requested
to be written.  It also correctly handles an NFSv3 request which requests
to write more data than the server has stated that it is prepared to
handle.  Previously, there was some support which looked like it should
work, but wasn't quite right.

Signed-off-by: Peter Staubach <staubach@redhat.com>
Acked-by: Neil Brown <neilb@suse.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
fs/nfsd/nfs3xdr.c
fs/nfsd/nfsxdr.c