linux-nfs.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Peng Tao <bergwolf@gmail.com>
To: linux-nfs@vger.kernel.org
Cc: Trond.Myklebust@netapp.com, bhalevy@tonian.com,
	Peng Tao <peng_tao@emc.com>
Subject: [PATCH 1/2 RESEND] NFS4: fix cb_recallany decode error
Date: Mon, 31 Oct 2011 08:15:35 -0700	[thread overview]
Message-ID: <1320074136-3087-1-git-send-email-bergwolf@gmail.com> (raw)

craa_type_mask is bitmap4 according to RFC5661. We need to expect a length before
extracting its value.

Signed-off-by: Peng Tao <peng_tao@emc.com>
---
Resend this one as it is a dependency for "[PATCH 2/2] nfs41: handle BLK_LAYOUT CB_RECALL_ANY".

 fs/nfs/callback_xdr.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/fs/nfs/callback_xdr.c b/fs/nfs/callback_xdr.c
index 918ad64..ee1a5b3 100644
--- a/fs/nfs/callback_xdr.c
+++ b/fs/nfs/callback_xdr.c
@@ -488,17 +488,18 @@ static __be32 decode_recallany_args(struct svc_rqst *rqstp,
 				      struct xdr_stream *xdr,
 				      struct cb_recallanyargs *args)
 {
-	__be32 *p;
+	uint32_t bitmap[2];
+	__be32 *p, status;
 
 	args->craa_addr = svc_addr(rqstp);
 	p = read_buf(xdr, 4);
 	if (unlikely(p == NULL))
 		return htonl(NFS4ERR_BADXDR);
 	args->craa_objs_to_keep = ntohl(*p++);
-	p = read_buf(xdr, 4);
-	if (unlikely(p == NULL))
-		return htonl(NFS4ERR_BADXDR);
-	args->craa_type_mask = ntohl(*p);
+	status = decode_bitmap(xdr, bitmap);
+	if (unlikely(status))
+		return status;
+	args->craa_type_mask = bitmap[0];
 
 	return 0;
 }
-- 
1.7.1.262.g5ef3d


             reply	other threads:[~2011-10-31 15:16 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-31 15:15 Peng Tao [this message]
2011-10-31 15:15 ` [PATCH 2/2] nfs41: handle BLK_LAYOUT CB_RECALL_ANY Peng Tao
2011-10-31 15:49   ` Trond Myklebust
2011-10-31 16:38     ` Peng Tao
2011-10-31 16:45       ` Trond Myklebust
2011-10-31 17:02         ` Peng Tao
2011-10-31 17:08         ` Benny Halevy
2011-10-31 17:42           ` Trond Myklebust
2011-10-31 17:57             ` Benny Halevy
2011-10-31 18:20               ` Trond Myklebust
2011-10-31 18:23                 ` [nfsv4] " Matt W. Benjamin
2011-10-31 18:31                   ` Trond Myklebust
2011-10-31 18:31                 ` Jim Rees
2011-10-31 18:39                   ` Trond Myklebust
2011-11-01  5:29                     ` tao.peng
2011-11-04  1:33                       ` tao.peng
2011-10-31 21:42                   ` [nfsv4] " Welch, Brent
2011-11-01 14:59                     ` david.noveck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1320074136-3087-1-git-send-email-bergwolf@gmail.com \
    --to=bergwolf@gmail.com \
    --cc=Trond.Myklebust@netapp.com \
    --cc=bhalevy@tonian.com \
    --cc=linux-nfs@vger.kernel.org \
    --cc=peng_tao@emc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).