diff options
author | Bryan Schumaker <bjschuma@netapp.com> | 2012-04-27 13:27:38 -0400 |
---|---|---|
committer | Trond Myklebust <Trond.Myklebust@netapp.com> | 2012-04-27 14:10:01 -0400 |
commit | 31e4dda4747713de13889f7c79c7aec341fea61b (patch) | |
tree | 9ec536cc095e2e512d1863301dcf37ca92dde8b5 /fs | |
parent | ea8cfa06795bb30d2ea61f503ef129284492c06a (diff) |
NFS: Fix SECINFO_NO_NAME
I was using the same decoder function for SECINFO and SECINFO_NO_NAME,
so it was returning an error when it tried to decode an OP_SECINFO_NO_NAME
header as OP_SECINFO.
Signed-off-by: Bryan Schumaker <bjschuma@netapp.com>
Signed-off-by: Trond Myklebust <Trond.Myklebust@netapp.com>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/nfs/nfs4xdr.c | 24 |
1 files changed, 19 insertions, 5 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 203c0967451b..c77e802db736 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -5094,16 +5094,13 @@ out_err: | |||
5094 | return -EINVAL; | 5094 | return -EINVAL; |
5095 | } | 5095 | } |
5096 | 5096 | ||
5097 | static int decode_secinfo(struct xdr_stream *xdr, struct nfs4_secinfo_res *res) | 5097 | static int decode_secinfo_common(struct xdr_stream *xdr, struct nfs4_secinfo_res *res) |
5098 | { | 5098 | { |
5099 | struct nfs4_secinfo_flavor *sec_flavor; | 5099 | struct nfs4_secinfo_flavor *sec_flavor; |
5100 | int status; | 5100 | int status; |
5101 | __be32 *p; | 5101 | __be32 *p; |
5102 | int i, num_flavors; | 5102 | int i, num_flavors; |
5103 | 5103 | ||
5104 | status = decode_op_hdr(xdr, OP_SECINFO); | ||
5105 | if (status) | ||
5106 | goto out; | ||
5107 | p = xdr_inline_decode(xdr, 4); | 5104 | p = xdr_inline_decode(xdr, 4); |
5108 | if (unlikely(!p)) | 5105 | if (unlikely(!p)) |
5109 | goto out_overflow; | 5106 | goto out_overflow; |
@@ -5129,6 +5126,7 @@ static int decode_secinfo(struct xdr_stream *xdr, struct nfs4_secinfo_res *res) | |||
5129 | res->flavors->num_flavors++; | 5126 | res->flavors->num_flavors++; |
5130 | } | 5127 | } |
5131 | 5128 | ||
5129 | status = 0; | ||
5132 | out: | 5130 | out: |
5133 | return status; | 5131 | return status; |
5134 | out_overflow: | 5132 | out_overflow: |
@@ -5136,7 +5134,23 @@ out_overflow: | |||
5136 | return -EIO; | 5134 | return -EIO; |
5137 | } | 5135 | } |
5138 | 5136 | ||
5137 | static int decode_secinfo(struct xdr_stream *xdr, struct nfs4_secinfo_res *res) | ||
5138 | { | ||
5139 | int status = decode_op_hdr(xdr, OP_SECINFO); | ||
5140 | if (status) | ||
5141 | return status; | ||
5142 | return decode_secinfo_common(xdr, res); | ||
5143 | } | ||
5144 | |||
5139 | #if defined(CONFIG_NFS_V4_1) | 5145 | #if defined(CONFIG_NFS_V4_1) |
5146 | static int decode_secinfo_no_name(struct xdr_stream *xdr, struct nfs4_secinfo_res *res) | ||
5147 | { | ||
5148 | int status = decode_op_hdr(xdr, OP_SECINFO_NO_NAME); | ||
5149 | if (status) | ||
5150 | return status; | ||
5151 | return decode_secinfo_common(xdr, res); | ||
5152 | } | ||
5153 | |||
5140 | static int decode_exchange_id(struct xdr_stream *xdr, | 5154 | static int decode_exchange_id(struct xdr_stream *xdr, |
5141 | struct nfs41_exchange_id_res *res) | 5155 | struct nfs41_exchange_id_res *res) |
5142 | { | 5156 | { |
@@ -6821,7 +6835,7 @@ static int nfs4_xdr_dec_secinfo_no_name(struct rpc_rqst *rqstp, | |||
6821 | status = decode_putrootfh(xdr); | 6835 | status = decode_putrootfh(xdr); |
6822 | if (status) | 6836 | if (status) |
6823 | goto out; | 6837 | goto out; |
6824 | status = decode_secinfo(xdr, res); | 6838 | status = decode_secinfo_no_name(xdr, res); |
6825 | out: | 6839 | out: |
6826 | return status; | 6840 | return status; |
6827 | } | 6841 | } |