diff options
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r-- | fs/nfs/nfs4xdr.c | 126 |
1 files changed, 84 insertions, 42 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c index 8003c91ccb9a..c08738441f73 100644 --- a/fs/nfs/nfs4xdr.c +++ b/fs/nfs/nfs4xdr.c | |||
@@ -68,9 +68,10 @@ static int nfs4_stat_to_errno(int); | |||
68 | #endif | 68 | #endif |
69 | 69 | ||
70 | /* lock,open owner id: | 70 | /* lock,open owner id: |
71 | * we currently use size 1 (u32) out of (NFS4_OPAQUE_LIMIT >> 2) | 71 | * we currently use size 2 (u64) out of (NFS4_OPAQUE_LIMIT >> 2) |
72 | */ | 72 | */ |
73 | #define owner_id_maxsz (1 + 1) | 73 | #define open_owner_id_maxsz (1 + 4) |
74 | #define lock_owner_id_maxsz (1 + 4) | ||
74 | #define compound_encode_hdr_maxsz (3 + (NFS4_MAXTAGLEN >> 2)) | 75 | #define compound_encode_hdr_maxsz (3 + (NFS4_MAXTAGLEN >> 2)) |
75 | #define compound_decode_hdr_maxsz (3 + (NFS4_MAXTAGLEN >> 2)) | 76 | #define compound_decode_hdr_maxsz (3 + (NFS4_MAXTAGLEN >> 2)) |
76 | #define op_encode_hdr_maxsz (1) | 77 | #define op_encode_hdr_maxsz (1) |
@@ -87,9 +88,11 @@ static int nfs4_stat_to_errno(int); | |||
87 | #define encode_getattr_maxsz (op_encode_hdr_maxsz + nfs4_fattr_bitmap_maxsz) | 88 | #define encode_getattr_maxsz (op_encode_hdr_maxsz + nfs4_fattr_bitmap_maxsz) |
88 | #define nfs4_name_maxsz (1 + ((3 + NFS4_MAXNAMLEN) >> 2)) | 89 | #define nfs4_name_maxsz (1 + ((3 + NFS4_MAXNAMLEN) >> 2)) |
89 | #define nfs4_path_maxsz (1 + ((3 + NFS4_MAXPATHLEN) >> 2)) | 90 | #define nfs4_path_maxsz (1 + ((3 + NFS4_MAXPATHLEN) >> 2)) |
91 | #define nfs4_owner_maxsz (1 + XDR_QUADLEN(IDMAP_NAMESZ)) | ||
92 | #define nfs4_group_maxsz (1 + XDR_QUADLEN(IDMAP_NAMESZ)) | ||
90 | /* This is based on getfattr, which uses the most attributes: */ | 93 | /* This is based on getfattr, which uses the most attributes: */ |
91 | #define nfs4_fattr_value_maxsz (1 + (1 + 2 + 2 + 4 + 2 + 1 + 1 + 2 + 2 + \ | 94 | #define nfs4_fattr_value_maxsz (1 + (1 + 2 + 2 + 4 + 2 + 1 + 1 + 2 + 2 + \ |
92 | 3 + 3 + 3 + 2 * nfs4_name_maxsz)) | 95 | 3 + 3 + 3 + nfs4_owner_maxsz + nfs4_group_maxsz)) |
93 | #define nfs4_fattr_maxsz (nfs4_fattr_bitmap_maxsz + \ | 96 | #define nfs4_fattr_maxsz (nfs4_fattr_bitmap_maxsz + \ |
94 | nfs4_fattr_value_maxsz) | 97 | nfs4_fattr_value_maxsz) |
95 | #define decode_getattr_maxsz (op_decode_hdr_maxsz + nfs4_fattr_maxsz) | 98 | #define decode_getattr_maxsz (op_decode_hdr_maxsz + nfs4_fattr_maxsz) |
@@ -116,8 +119,27 @@ static int nfs4_stat_to_errno(int); | |||
116 | 3 + (NFS4_VERIFIER_SIZE >> 2)) | 119 | 3 + (NFS4_VERIFIER_SIZE >> 2)) |
117 | #define decode_setclientid_confirm_maxsz \ | 120 | #define decode_setclientid_confirm_maxsz \ |
118 | (op_decode_hdr_maxsz) | 121 | (op_decode_hdr_maxsz) |
119 | #define encode_lookup_maxsz (op_encode_hdr_maxsz + \ | 122 | #define encode_lookup_maxsz (op_encode_hdr_maxsz + nfs4_name_maxsz) |
120 | 1 + ((3 + NFS4_FHSIZE) >> 2)) | 123 | #define decode_lookup_maxsz (op_decode_hdr_maxsz) |
124 | #define encode_share_access_maxsz \ | ||
125 | (2) | ||
126 | #define encode_createmode_maxsz (1 + nfs4_fattr_maxsz) | ||
127 | #define encode_opentype_maxsz (1 + encode_createmode_maxsz) | ||
128 | #define encode_claim_null_maxsz (1 + nfs4_name_maxsz) | ||
129 | #define encode_open_maxsz (op_encode_hdr_maxsz + \ | ||
130 | 2 + encode_share_access_maxsz + 2 + \ | ||
131 | open_owner_id_maxsz + \ | ||
132 | encode_opentype_maxsz + \ | ||
133 | encode_claim_null_maxsz) | ||
134 | #define decode_ace_maxsz (3 + nfs4_owner_maxsz) | ||
135 | #define decode_delegation_maxsz (1 + XDR_QUADLEN(NFS4_STATEID_SIZE) + 1 + \ | ||
136 | decode_ace_maxsz) | ||
137 | #define decode_change_info_maxsz (5) | ||
138 | #define decode_open_maxsz (op_decode_hdr_maxsz + \ | ||
139 | XDR_QUADLEN(NFS4_STATEID_SIZE) + \ | ||
140 | decode_change_info_maxsz + 1 + \ | ||
141 | nfs4_fattr_bitmap_maxsz + \ | ||
142 | decode_delegation_maxsz) | ||
121 | #define encode_remove_maxsz (op_encode_hdr_maxsz + \ | 143 | #define encode_remove_maxsz (op_encode_hdr_maxsz + \ |
122 | nfs4_name_maxsz) | 144 | nfs4_name_maxsz) |
123 | #define encode_rename_maxsz (op_encode_hdr_maxsz + \ | 145 | #define encode_rename_maxsz (op_encode_hdr_maxsz + \ |
@@ -134,9 +156,15 @@ static int nfs4_stat_to_errno(int); | |||
134 | #define encode_create_maxsz (op_encode_hdr_maxsz + \ | 156 | #define encode_create_maxsz (op_encode_hdr_maxsz + \ |
135 | 2 + nfs4_name_maxsz + \ | 157 | 2 + nfs4_name_maxsz + \ |
136 | nfs4_fattr_maxsz) | 158 | nfs4_fattr_maxsz) |
137 | #define decode_create_maxsz (op_decode_hdr_maxsz + 8) | 159 | #define decode_create_maxsz (op_decode_hdr_maxsz + \ |
160 | decode_change_info_maxsz + \ | ||
161 | nfs4_fattr_bitmap_maxsz) | ||
138 | #define encode_delegreturn_maxsz (op_encode_hdr_maxsz + 4) | 162 | #define encode_delegreturn_maxsz (op_encode_hdr_maxsz + 4) |
139 | #define decode_delegreturn_maxsz (op_decode_hdr_maxsz) | 163 | #define decode_delegreturn_maxsz (op_decode_hdr_maxsz) |
164 | #define encode_fs_locations_maxsz \ | ||
165 | (encode_getattr_maxsz) | ||
166 | #define decode_fs_locations_maxsz \ | ||
167 | (0) | ||
140 | #define NFS4_enc_compound_sz (1024) /* XXX: large enough? */ | 168 | #define NFS4_enc_compound_sz (1024) /* XXX: large enough? */ |
141 | #define NFS4_dec_compound_sz (1024) /* XXX: large enough? */ | 169 | #define NFS4_dec_compound_sz (1024) /* XXX: large enough? */ |
142 | #define NFS4_enc_read_sz (compound_encode_hdr_maxsz + \ | 170 | #define NFS4_enc_read_sz (compound_encode_hdr_maxsz + \ |
@@ -174,16 +202,21 @@ static int nfs4_stat_to_errno(int); | |||
174 | op_decode_hdr_maxsz + 2 + \ | 202 | op_decode_hdr_maxsz + 2 + \ |
175 | decode_getattr_maxsz) | 203 | decode_getattr_maxsz) |
176 | #define NFS4_enc_open_sz (compound_encode_hdr_maxsz + \ | 204 | #define NFS4_enc_open_sz (compound_encode_hdr_maxsz + \ |
177 | encode_putfh_maxsz + \ | 205 | encode_putfh_maxsz + \ |
178 | op_encode_hdr_maxsz + \ | 206 | encode_savefh_maxsz + \ |
179 | 13 + 3 + 2 + 64 + \ | 207 | encode_open_maxsz + \ |
180 | encode_getattr_maxsz + \ | 208 | encode_getfh_maxsz + \ |
181 | encode_getfh_maxsz) | 209 | encode_getattr_maxsz + \ |
210 | encode_restorefh_maxsz + \ | ||
211 | encode_getattr_maxsz) | ||
182 | #define NFS4_dec_open_sz (compound_decode_hdr_maxsz + \ | 212 | #define NFS4_dec_open_sz (compound_decode_hdr_maxsz + \ |
183 | decode_putfh_maxsz + \ | 213 | decode_putfh_maxsz + \ |
184 | op_decode_hdr_maxsz + 4 + 5 + 2 + 3 + \ | 214 | decode_savefh_maxsz + \ |
185 | decode_getattr_maxsz + \ | 215 | decode_open_maxsz + \ |
186 | decode_getfh_maxsz) | 216 | decode_getfh_maxsz + \ |
217 | decode_getattr_maxsz + \ | ||
218 | decode_restorefh_maxsz + \ | ||
219 | decode_getattr_maxsz) | ||
187 | #define NFS4_enc_open_confirm_sz \ | 220 | #define NFS4_enc_open_confirm_sz \ |
188 | (compound_encode_hdr_maxsz + \ | 221 | (compound_encode_hdr_maxsz + \ |
189 | encode_putfh_maxsz + \ | 222 | encode_putfh_maxsz + \ |
@@ -193,12 +226,12 @@ static int nfs4_stat_to_errno(int); | |||
193 | op_decode_hdr_maxsz + 4) | 226 | op_decode_hdr_maxsz + 4) |
194 | #define NFS4_enc_open_noattr_sz (compound_encode_hdr_maxsz + \ | 227 | #define NFS4_enc_open_noattr_sz (compound_encode_hdr_maxsz + \ |
195 | encode_putfh_maxsz + \ | 228 | encode_putfh_maxsz + \ |
196 | op_encode_hdr_maxsz + \ | 229 | encode_open_maxsz + \ |
197 | 11) | 230 | encode_getattr_maxsz) |
198 | #define NFS4_dec_open_noattr_sz (compound_decode_hdr_maxsz + \ | 231 | #define NFS4_dec_open_noattr_sz (compound_decode_hdr_maxsz + \ |
199 | decode_putfh_maxsz + \ | 232 | decode_putfh_maxsz + \ |
200 | op_decode_hdr_maxsz + \ | 233 | decode_open_maxsz + \ |
201 | 4 + 5 + 2 + 3) | 234 | decode_getattr_maxsz) |
202 | #define NFS4_enc_open_downgrade_sz \ | 235 | #define NFS4_enc_open_downgrade_sz \ |
203 | (compound_encode_hdr_maxsz + \ | 236 | (compound_encode_hdr_maxsz + \ |
204 | encode_putfh_maxsz + \ | 237 | encode_putfh_maxsz + \ |
@@ -256,19 +289,19 @@ static int nfs4_stat_to_errno(int); | |||
256 | op_encode_hdr_maxsz + \ | 289 | op_encode_hdr_maxsz + \ |
257 | 1 + 1 + 2 + 2 + \ | 290 | 1 + 1 + 2 + 2 + \ |
258 | 1 + 4 + 1 + 2 + \ | 291 | 1 + 4 + 1 + 2 + \ |
259 | owner_id_maxsz) | 292 | lock_owner_id_maxsz) |
260 | #define NFS4_dec_lock_sz (compound_decode_hdr_maxsz + \ | 293 | #define NFS4_dec_lock_sz (compound_decode_hdr_maxsz + \ |
261 | decode_putfh_maxsz + \ | 294 | decode_putfh_maxsz + \ |
262 | decode_getattr_maxsz + \ | 295 | decode_getattr_maxsz + \ |
263 | op_decode_hdr_maxsz + \ | 296 | op_decode_hdr_maxsz + \ |
264 | 2 + 2 + 1 + 2 + \ | 297 | 2 + 2 + 1 + 2 + \ |
265 | owner_id_maxsz) | 298 | lock_owner_id_maxsz) |
266 | #define NFS4_enc_lockt_sz (compound_encode_hdr_maxsz + \ | 299 | #define NFS4_enc_lockt_sz (compound_encode_hdr_maxsz + \ |
267 | encode_putfh_maxsz + \ | 300 | encode_putfh_maxsz + \ |
268 | encode_getattr_maxsz + \ | 301 | encode_getattr_maxsz + \ |
269 | op_encode_hdr_maxsz + \ | 302 | op_encode_hdr_maxsz + \ |
270 | 1 + 2 + 2 + 2 + \ | 303 | 1 + 2 + 2 + 2 + \ |
271 | owner_id_maxsz) | 304 | lock_owner_id_maxsz) |
272 | #define NFS4_dec_lockt_sz (NFS4_dec_lock_sz) | 305 | #define NFS4_dec_lockt_sz (NFS4_dec_lock_sz) |
273 | #define NFS4_enc_locku_sz (compound_encode_hdr_maxsz + \ | 306 | #define NFS4_enc_locku_sz (compound_encode_hdr_maxsz + \ |
274 | encode_putfh_maxsz + \ | 307 | encode_putfh_maxsz + \ |
@@ -298,7 +331,7 @@ static int nfs4_stat_to_errno(int); | |||
298 | encode_getfh_maxsz) | 331 | encode_getfh_maxsz) |
299 | #define NFS4_dec_lookup_sz (compound_decode_hdr_maxsz + \ | 332 | #define NFS4_dec_lookup_sz (compound_decode_hdr_maxsz + \ |
300 | decode_putfh_maxsz + \ | 333 | decode_putfh_maxsz + \ |
301 | op_decode_hdr_maxsz + \ | 334 | decode_lookup_maxsz + \ |
302 | decode_getattr_maxsz + \ | 335 | decode_getattr_maxsz + \ |
303 | decode_getfh_maxsz) | 336 | decode_getfh_maxsz) |
304 | #define NFS4_enc_lookup_root_sz (compound_encode_hdr_maxsz + \ | 337 | #define NFS4_enc_lookup_root_sz (compound_encode_hdr_maxsz + \ |
@@ -417,12 +450,13 @@ static int nfs4_stat_to_errno(int); | |||
417 | #define NFS4_enc_fs_locations_sz \ | 450 | #define NFS4_enc_fs_locations_sz \ |
418 | (compound_encode_hdr_maxsz + \ | 451 | (compound_encode_hdr_maxsz + \ |
419 | encode_putfh_maxsz + \ | 452 | encode_putfh_maxsz + \ |
420 | encode_getattr_maxsz) | 453 | encode_lookup_maxsz + \ |
454 | encode_fs_locations_maxsz) | ||
421 | #define NFS4_dec_fs_locations_sz \ | 455 | #define NFS4_dec_fs_locations_sz \ |
422 | (compound_decode_hdr_maxsz + \ | 456 | (compound_decode_hdr_maxsz + \ |
423 | decode_putfh_maxsz + \ | 457 | decode_putfh_maxsz + \ |
424 | op_decode_hdr_maxsz + \ | 458 | decode_lookup_maxsz + \ |
425 | nfs4_fattr_bitmap_maxsz) | 459 | decode_fs_locations_maxsz) |
426 | 460 | ||
427 | static struct { | 461 | static struct { |
428 | unsigned int mode; | 462 | unsigned int mode; |
@@ -793,13 +827,14 @@ static int encode_lock(struct xdr_stream *xdr, const struct nfs_lock_args *args) | |||
793 | WRITE64(nfs4_lock_length(args->fl)); | 827 | WRITE64(nfs4_lock_length(args->fl)); |
794 | WRITE32(args->new_lock_owner); | 828 | WRITE32(args->new_lock_owner); |
795 | if (args->new_lock_owner){ | 829 | if (args->new_lock_owner){ |
796 | RESERVE_SPACE(4+NFS4_STATEID_SIZE+20); | 830 | RESERVE_SPACE(4+NFS4_STATEID_SIZE+32); |
797 | WRITE32(args->open_seqid->sequence->counter); | 831 | WRITE32(args->open_seqid->sequence->counter); |
798 | WRITEMEM(args->open_stateid->data, NFS4_STATEID_SIZE); | 832 | WRITEMEM(args->open_stateid->data, NFS4_STATEID_SIZE); |
799 | WRITE32(args->lock_seqid->sequence->counter); | 833 | WRITE32(args->lock_seqid->sequence->counter); |
800 | WRITE64(args->lock_owner.clientid); | 834 | WRITE64(args->lock_owner.clientid); |
801 | WRITE32(4); | 835 | WRITE32(16); |
802 | WRITE32(args->lock_owner.id); | 836 | WRITEMEM("lock id:", 8); |
837 | WRITE64(args->lock_owner.id); | ||
803 | } | 838 | } |
804 | else { | 839 | else { |
805 | RESERVE_SPACE(NFS4_STATEID_SIZE+4); | 840 | RESERVE_SPACE(NFS4_STATEID_SIZE+4); |
@@ -814,14 +849,15 @@ static int encode_lockt(struct xdr_stream *xdr, const struct nfs_lockt_args *arg | |||
814 | { | 849 | { |
815 | __be32 *p; | 850 | __be32 *p; |
816 | 851 | ||
817 | RESERVE_SPACE(40); | 852 | RESERVE_SPACE(52); |
818 | WRITE32(OP_LOCKT); | 853 | WRITE32(OP_LOCKT); |
819 | WRITE32(nfs4_lock_type(args->fl, 0)); | 854 | WRITE32(nfs4_lock_type(args->fl, 0)); |
820 | WRITE64(args->fl->fl_start); | 855 | WRITE64(args->fl->fl_start); |
821 | WRITE64(nfs4_lock_length(args->fl)); | 856 | WRITE64(nfs4_lock_length(args->fl)); |
822 | WRITE64(args->lock_owner.clientid); | 857 | WRITE64(args->lock_owner.clientid); |
823 | WRITE32(4); | 858 | WRITE32(16); |
824 | WRITE32(args->lock_owner.id); | 859 | WRITEMEM("lock id:", 8); |
860 | WRITE64(args->lock_owner.id); | ||
825 | 861 | ||
826 | return 0; | 862 | return 0; |
827 | } | 863 | } |
@@ -886,10 +922,11 @@ static inline void encode_openhdr(struct xdr_stream *xdr, const struct nfs_opena | |||
886 | WRITE32(OP_OPEN); | 922 | WRITE32(OP_OPEN); |
887 | WRITE32(arg->seqid->sequence->counter); | 923 | WRITE32(arg->seqid->sequence->counter); |
888 | encode_share_access(xdr, arg->open_flags); | 924 | encode_share_access(xdr, arg->open_flags); |
889 | RESERVE_SPACE(16); | 925 | RESERVE_SPACE(28); |
890 | WRITE64(arg->clientid); | 926 | WRITE64(arg->clientid); |
891 | WRITE32(4); | 927 | WRITE32(16); |
892 | WRITE32(arg->id); | 928 | WRITEMEM("open id:", 8); |
929 | WRITE64(arg->id); | ||
893 | } | 930 | } |
894 | 931 | ||
895 | static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_openargs *arg) | 932 | static inline void encode_createmode(struct xdr_stream *xdr, const struct nfs_openargs *arg) |
@@ -1071,7 +1108,7 @@ static int encode_read(struct xdr_stream *xdr, const struct nfs_readargs *args) | |||
1071 | 1108 | ||
1072 | static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg *readdir, struct rpc_rqst *req) | 1109 | static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg *readdir, struct rpc_rqst *req) |
1073 | { | 1110 | { |
1074 | struct rpc_auth *auth = req->rq_task->tk_auth; | 1111 | struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth; |
1075 | uint32_t attrs[2] = { | 1112 | uint32_t attrs[2] = { |
1076 | FATTR4_WORD0_RDATTR_ERROR|FATTR4_WORD0_FILEID, | 1113 | FATTR4_WORD0_RDATTR_ERROR|FATTR4_WORD0_FILEID, |
1077 | FATTR4_WORD1_MOUNTED_ON_FILEID, | 1114 | FATTR4_WORD1_MOUNTED_ON_FILEID, |
@@ -1117,7 +1154,7 @@ static int encode_readdir(struct xdr_stream *xdr, const struct nfs4_readdir_arg | |||
1117 | 1154 | ||
1118 | static int encode_readlink(struct xdr_stream *xdr, const struct nfs4_readlink *readlink, struct rpc_rqst *req) | 1155 | static int encode_readlink(struct xdr_stream *xdr, const struct nfs4_readlink *readlink, struct rpc_rqst *req) |
1119 | { | 1156 | { |
1120 | struct rpc_auth *auth = req->rq_task->tk_auth; | 1157 | struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth; |
1121 | unsigned int replen; | 1158 | unsigned int replen; |
1122 | __be32 *p; | 1159 | __be32 *p; |
1123 | 1160 | ||
@@ -1735,7 +1772,7 @@ out: | |||
1735 | */ | 1772 | */ |
1736 | static int nfs4_xdr_enc_read(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args) | 1773 | static int nfs4_xdr_enc_read(struct rpc_rqst *req, __be32 *p, struct nfs_readargs *args) |
1737 | { | 1774 | { |
1738 | struct rpc_auth *auth = req->rq_task->tk_auth; | 1775 | struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth; |
1739 | struct xdr_stream xdr; | 1776 | struct xdr_stream xdr; |
1740 | struct compound_hdr hdr = { | 1777 | struct compound_hdr hdr = { |
1741 | .nops = 2, | 1778 | .nops = 2, |
@@ -1795,7 +1832,7 @@ nfs4_xdr_enc_getacl(struct rpc_rqst *req, __be32 *p, | |||
1795 | struct nfs_getaclargs *args) | 1832 | struct nfs_getaclargs *args) |
1796 | { | 1833 | { |
1797 | struct xdr_stream xdr; | 1834 | struct xdr_stream xdr; |
1798 | struct rpc_auth *auth = req->rq_task->tk_auth; | 1835 | struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth; |
1799 | struct compound_hdr hdr = { | 1836 | struct compound_hdr hdr = { |
1800 | .nops = 2, | 1837 | .nops = 2, |
1801 | }; | 1838 | }; |
@@ -2030,7 +2067,7 @@ static int nfs4_xdr_enc_fs_locations(struct rpc_rqst *req, __be32 *p, struct nfs | |||
2030 | struct compound_hdr hdr = { | 2067 | struct compound_hdr hdr = { |
2031 | .nops = 3, | 2068 | .nops = 3, |
2032 | }; | 2069 | }; |
2033 | struct rpc_auth *auth = req->rq_task->tk_auth; | 2070 | struct rpc_auth *auth = req->rq_task->tk_msg.rpc_cred->cr_auth; |
2034 | int replen; | 2071 | int replen; |
2035 | int status; | 2072 | int status; |
2036 | 2073 | ||
@@ -3269,7 +3306,7 @@ static int decode_delegation(struct xdr_stream *xdr, struct nfs_openres *res) | |||
3269 | static int decode_open(struct xdr_stream *xdr, struct nfs_openres *res) | 3306 | static int decode_open(struct xdr_stream *xdr, struct nfs_openres *res) |
3270 | { | 3307 | { |
3271 | __be32 *p; | 3308 | __be32 *p; |
3272 | uint32_t bmlen; | 3309 | uint32_t savewords, bmlen, i; |
3273 | int status; | 3310 | int status; |
3274 | 3311 | ||
3275 | status = decode_op_hdr(xdr, OP_OPEN); | 3312 | status = decode_op_hdr(xdr, OP_OPEN); |
@@ -3287,7 +3324,12 @@ static int decode_open(struct xdr_stream *xdr, struct nfs_openres *res) | |||
3287 | goto xdr_error; | 3324 | goto xdr_error; |
3288 | 3325 | ||
3289 | READ_BUF(bmlen << 2); | 3326 | READ_BUF(bmlen << 2); |
3290 | p += bmlen; | 3327 | savewords = min_t(uint32_t, bmlen, NFS4_BITMAP_SIZE); |
3328 | for (i = 0; i < savewords; ++i) | ||
3329 | READ32(res->attrset[i]); | ||
3330 | for (; i < NFS4_BITMAP_SIZE; i++) | ||
3331 | res->attrset[i] = 0; | ||
3332 | |||
3291 | return decode_delegation(xdr, res); | 3333 | return decode_delegation(xdr, res); |
3292 | xdr_error: | 3334 | xdr_error: |
3293 | dprintk("%s: Bitmap too large! Length = %u\n", __FUNCTION__, bmlen); | 3335 | dprintk("%s: Bitmap too large! Length = %u\n", __FUNCTION__, bmlen); |