[pnfs] Resend: [PATCH] fix bug in decode_compound_hdr_arg

Benny Halevy bhalevy at panasas.com
Thu Jul 12 12:45:50 EDT 2007



-------- Original Message --------
Subject: [PATCH] fix bug in decode_compound_hdr_arg
Date: Mon,  9 Jul 2007 16:02:29 +0300
From: Benny Halevy <bhalevy at panasas.com>
To: pnfs at linux-pnfs.org
CC: Benny Halevy <bhalevy at panasas.com>

extra 4 bytes were decoded for minorversion1 (draft10)

Signed-off-by: Benny Halevy <bhalevy at panasas.com>
---
 fs/nfs/callback_xdr.c |   12 +++++++-----
 1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
index 36e1f02..cb73532 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -162,14 +162,16 @@ static unsigned decode_compound_hdr_arg(struct xdr_stream *xdr, struct cb_compou
 				__FUNCTION__, hdr->taglen);
 		return htonl(NFS4ERR_RESOURCE);
 	}
-	p = read_buf(xdr, 12);
+	p = read_buf(xdr, 4);
 	if (unlikely(p == NULL))
 		return htonl(NFS4ERR_RESOURCE);
-	hdr->minorversion = ntohl(*p++);
-	/* Check minor version is zero. */
-	if (hdr->minorversion == 0)
+	hdr->minorversion = ntohl(*p);
+	if (hdr->minorversion == 0) {
+		p = read_buf(xdr, 8);
 		hdr->callback_ident = ntohl(*p++);
-	else if (hdr->minorversion != 1) {
+	} else if (hdr->minorversion == 1) {
+		p = read_buf(xdr, 4);
+	} else {
 		printk(KERN_WARNING "%s: NFSv4 server callback with illegal minor version %u!\n",
 				__FUNCTION__, hdr->minorversion);
 		return htonl(NFS4ERR_MINOR_VERS_MISMATCH);
-- 
1.5.2.86.g99b5



More information about the pNFS mailing list