]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
knfsd: Allow NFSv2/3 WRITE calls to succeed when krb5i etc is used.
authorNeilBrown <neilb@suse.de>
Fri, 11 Jan 2008 22:06:52 +0000 (17:06 -0500)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 8 Feb 2008 20:01:45 +0000 (12:01 -0800)
patch ba67a39efde8312e386c6f603054f8945433d91f in mainline.

When RPCSEC/GSS and krb5i is used, requests are padded, typically to a multiple
of 8 bytes.  This can make the request look slightly longer than it
really is.

As of

f34b95689d2ce001c "The NFSv2/NFSv3 server does not handle zero
length WRITE request correctly",

the xdr decode routines for NFSv2 and NFSv3 reject requests that aren't
the right length, so krb5i (for example) WRITE requests can get lost.

This patch relaxes the appropriate test and enhances the related comment.

Signed-off-by: Neil Brown <neilb@suse.de>
Signed-off-by: J. Bruce Fields <bfields@citi.umich.edu>
Cc: Peter Staubach <staubach@redhat.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
fs/nfsd/nfs3xdr.c
fs/nfsd/nfsxdr.c

index 10f6e7dcf6336b48746cd6c16d7ed5c1d04cae28..2dc0a541b5eed13edf9ffaa371b07ec27f2ee906 100644 (file)
@@ -396,8 +396,11 @@ nfs3svc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p,
         * Round the length of the data which was specified up to
         * the next multiple of XDR units and then compare that
         * against the length which was actually received.
+        * Note that when RPCSEC/GSS (for example) is used, the
+        * data buffer can be padded so dlen might be larger
+        * than required.  It must never be smaller.
         */
-       if (dlen != XDR_QUADLEN(len)*4)
+       if (dlen < XDR_QUADLEN(len)*4)
                return 0;
 
        if (args->count > max_blocksize) {
index cb3e7fadb772127975898e14a43c6bd3dd4c4d92..bd3d5b95d7113147a50a7a8affc7823cd44717ef 100644 (file)
@@ -313,8 +313,11 @@ nfssvc_decode_writeargs(struct svc_rqst *rqstp, __be32 *p,
         * Round the length of the data which was specified up to
         * the next multiple of XDR units and then compare that
         * against the length which was actually received.
+        * Note that when RPCSEC/GSS (for example) is used, the
+        * data buffer can be padded so dlen might be larger
+        * than required.  It must never be smaller.
         */
-       if (dlen != XDR_QUADLEN(len)*4)
+       if (dlen < XDR_QUADLEN(len)*4)
                return 0;
 
        rqstp->rq_vec[0].iov_base = (void*)p;