aboutsummaryrefslogtreecommitdiffstats
path: root/fs/nfs/nfs4xdr.c
diff options
context:
space:
mode:
Diffstat (limited to 'fs/nfs/nfs4xdr.c')
-rw-r--r--fs/nfs/nfs4xdr.c529
1 files changed, 155 insertions, 374 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 2fc8f6fa25e4..6d9d5e2f6308 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -54,6 +54,7 @@
54#include <linux/nfs_fs.h> 54#include <linux/nfs_fs.h>
55 55
56#include "nfs4_fs.h" 56#include "nfs4_fs.h"
57#include "nfs4trace.h"
57#include "internal.h" 58#include "internal.h"
58#include "nfs4idmap.h" 59#include "nfs4idmap.h"
59#include "nfs4session.h" 60#include "nfs4session.h"
@@ -214,14 +215,14 @@ static int decode_layoutget(struct xdr_stream *xdr, struct rpc_rqst *req,
214 nfs4_fattr_bitmap_maxsz) 215 nfs4_fattr_bitmap_maxsz)
215#define encode_read_maxsz (op_encode_hdr_maxsz + \ 216#define encode_read_maxsz (op_encode_hdr_maxsz + \
216 encode_stateid_maxsz + 3) 217 encode_stateid_maxsz + 3)
217#define decode_read_maxsz (op_decode_hdr_maxsz + 2) 218#define decode_read_maxsz (op_decode_hdr_maxsz + 2 + 1)
218#define encode_readdir_maxsz (op_encode_hdr_maxsz + \ 219#define encode_readdir_maxsz (op_encode_hdr_maxsz + \
219 2 + encode_verifier_maxsz + 5 + \ 220 2 + encode_verifier_maxsz + 5 + \
220 nfs4_label_maxsz) 221 nfs4_label_maxsz)
221#define decode_readdir_maxsz (op_decode_hdr_maxsz + \ 222#define decode_readdir_maxsz (op_decode_hdr_maxsz + \
222 decode_verifier_maxsz) 223 decode_verifier_maxsz + 1)
223#define encode_readlink_maxsz (op_encode_hdr_maxsz) 224#define encode_readlink_maxsz (op_encode_hdr_maxsz)
224#define decode_readlink_maxsz (op_decode_hdr_maxsz + 1) 225#define decode_readlink_maxsz (op_decode_hdr_maxsz + 1 + 1)
225#define encode_write_maxsz (op_encode_hdr_maxsz + \ 226#define encode_write_maxsz (op_encode_hdr_maxsz + \
226 encode_stateid_maxsz + 4) 227 encode_stateid_maxsz + 4)
227#define decode_write_maxsz (op_decode_hdr_maxsz + \ 228#define decode_write_maxsz (op_decode_hdr_maxsz + \
@@ -283,14 +284,14 @@ static int decode_layoutget(struct xdr_stream *xdr, struct rpc_rqst *req,
283#define decode_delegreturn_maxsz (op_decode_hdr_maxsz) 284#define decode_delegreturn_maxsz (op_decode_hdr_maxsz)
284#define encode_getacl_maxsz (encode_getattr_maxsz) 285#define encode_getacl_maxsz (encode_getattr_maxsz)
285#define decode_getacl_maxsz (op_decode_hdr_maxsz + \ 286#define decode_getacl_maxsz (op_decode_hdr_maxsz + \
286 nfs4_fattr_bitmap_maxsz + 1) 287 nfs4_fattr_bitmap_maxsz + 1 + 1)
287#define encode_setacl_maxsz (op_encode_hdr_maxsz + \ 288#define encode_setacl_maxsz (op_encode_hdr_maxsz + \
288 encode_stateid_maxsz + 3) 289 encode_stateid_maxsz + 3)
289#define decode_setacl_maxsz (decode_setattr_maxsz) 290#define decode_setacl_maxsz (decode_setattr_maxsz)
290#define encode_fs_locations_maxsz \ 291#define encode_fs_locations_maxsz \
291 (encode_getattr_maxsz) 292 (encode_getattr_maxsz)
292#define decode_fs_locations_maxsz \ 293#define decode_fs_locations_maxsz \
293 (0) 294 (1)
294#define encode_secinfo_maxsz (op_encode_hdr_maxsz + nfs4_name_maxsz) 295#define encode_secinfo_maxsz (op_encode_hdr_maxsz + nfs4_name_maxsz)
295#define decode_secinfo_maxsz (op_decode_hdr_maxsz + 1 + ((NFS_MAX_SECFLAVORS * (16 + GSS_OID_MAX_LEN)) / 4)) 296#define decode_secinfo_maxsz (op_decode_hdr_maxsz + 1 + ((NFS_MAX_SECFLAVORS * (16 + GSS_OID_MAX_LEN)) / 4))
296 297
@@ -391,12 +392,13 @@ static int decode_layoutget(struct xdr_stream *xdr, struct rpc_rqst *req,
391 1 /* opaque devaddr4 length */ + \ 392 1 /* opaque devaddr4 length */ + \
392 /* devaddr4 payload is read into page */ \ 393 /* devaddr4 payload is read into page */ \
393 1 /* notification bitmap length */ + \ 394 1 /* notification bitmap length */ + \
394 1 /* notification bitmap, word 0 */) 395 1 /* notification bitmap, word 0 */ + \
396 1 /* possible XDR padding */)
395#define encode_layoutget_maxsz (op_encode_hdr_maxsz + 10 + \ 397#define encode_layoutget_maxsz (op_encode_hdr_maxsz + 10 + \
396 encode_stateid_maxsz) 398 encode_stateid_maxsz)
397#define decode_layoutget_maxsz (op_decode_hdr_maxsz + 8 + \ 399#define decode_layoutget_maxsz (op_decode_hdr_maxsz + 8 + \
398 decode_stateid_maxsz + \ 400 decode_stateid_maxsz + \
399 XDR_QUADLEN(PNFS_LAYOUT_MAXSIZE)) 401 XDR_QUADLEN(PNFS_LAYOUT_MAXSIZE) + 1)
400#define encode_layoutcommit_maxsz (op_encode_hdr_maxsz + \ 402#define encode_layoutcommit_maxsz (op_encode_hdr_maxsz + \
401 2 /* offset */ + \ 403 2 /* offset */ + \
402 2 /* length */ + \ 404 2 /* length */ + \
@@ -1015,12 +1017,11 @@ static void encode_compound_hdr(struct xdr_stream *xdr,
1015 struct compound_hdr *hdr) 1017 struct compound_hdr *hdr)
1016{ 1018{
1017 __be32 *p; 1019 __be32 *p;
1018 struct rpc_auth *auth = req->rq_cred->cr_auth;
1019 1020
1020 /* initialize running count of expected bytes in reply. 1021 /* initialize running count of expected bytes in reply.
1021 * NOTE: the replied tag SHOULD be the same is the one sent, 1022 * NOTE: the replied tag SHOULD be the same is the one sent,
1022 * but this is not required as a MUST for the server to do so. */ 1023 * but this is not required as a MUST for the server to do so. */
1023 hdr->replen = RPC_REPHDRSIZE + auth->au_rslack + 3 + hdr->taglen; 1024 hdr->replen = 3 + hdr->taglen;
1024 1025
1025 WARN_ON_ONCE(hdr->taglen > NFS4_MAXTAGLEN); 1026 WARN_ON_ONCE(hdr->taglen > NFS4_MAXTAGLEN);
1026 encode_string(xdr, hdr->taglen, hdr->tag); 1027 encode_string(xdr, hdr->taglen, hdr->tag);
@@ -2340,9 +2341,9 @@ static void nfs4_xdr_enc_open(struct rpc_rqst *req, struct xdr_stream *xdr,
2340 encode_getfattr_open(xdr, args->bitmask, args->open_bitmap, &hdr); 2341 encode_getfattr_open(xdr, args->bitmask, args->open_bitmap, &hdr);
2341 if (args->lg_args) { 2342 if (args->lg_args) {
2342 encode_layoutget(xdr, args->lg_args, &hdr); 2343 encode_layoutget(xdr, args->lg_args, &hdr);
2343 xdr_inline_pages(&req->rq_rcv_buf, hdr.replen << 2, 2344 rpc_prepare_reply_pages(req, args->lg_args->layout.pages, 0,
2344 args->lg_args->layout.pages, 2345 args->lg_args->layout.pglen,
2345 0, args->lg_args->layout.pglen); 2346 hdr.replen);
2346 } 2347 }
2347 encode_nops(&hdr); 2348 encode_nops(&hdr);
2348} 2349}
@@ -2386,9 +2387,9 @@ static void nfs4_xdr_enc_open_noattr(struct rpc_rqst *req,
2386 encode_getfattr_open(xdr, args->bitmask, args->open_bitmap, &hdr); 2387 encode_getfattr_open(xdr, args->bitmask, args->open_bitmap, &hdr);
2387 if (args->lg_args) { 2388 if (args->lg_args) {
2388 encode_layoutget(xdr, args->lg_args, &hdr); 2389 encode_layoutget(xdr, args->lg_args, &hdr);
2389 xdr_inline_pages(&req->rq_rcv_buf, hdr.replen << 2, 2390 rpc_prepare_reply_pages(req, args->lg_args->layout.pages, 0,
2390 args->lg_args->layout.pages, 2391 args->lg_args->layout.pglen,
2391 0, args->lg_args->layout.pglen); 2392 hdr.replen);
2392 } 2393 }
2393 encode_nops(&hdr); 2394 encode_nops(&hdr);
2394} 2395}
@@ -2498,8 +2499,8 @@ static void nfs4_xdr_enc_readlink(struct rpc_rqst *req, struct xdr_stream *xdr,
2498 encode_putfh(xdr, args->fh, &hdr); 2499 encode_putfh(xdr, args->fh, &hdr);
2499 encode_readlink(xdr, args, req, &hdr); 2500 encode_readlink(xdr, args, req, &hdr);
2500 2501
2501 xdr_inline_pages(&req->rq_rcv_buf, hdr.replen << 2, args->pages, 2502 rpc_prepare_reply_pages(req, args->pages, args->pgbase,
2502 args->pgbase, args->pglen); 2503 args->pglen, hdr.replen);
2503 encode_nops(&hdr); 2504 encode_nops(&hdr);
2504} 2505}
2505 2506
@@ -2519,11 +2520,8 @@ static void nfs4_xdr_enc_readdir(struct rpc_rqst *req, struct xdr_stream *xdr,
2519 encode_putfh(xdr, args->fh, &hdr); 2520 encode_putfh(xdr, args->fh, &hdr);
2520 encode_readdir(xdr, args, req, &hdr); 2521 encode_readdir(xdr, args, req, &hdr);
2521 2522
2522 xdr_inline_pages(&req->rq_rcv_buf, hdr.replen << 2, args->pages, 2523 rpc_prepare_reply_pages(req, args->pages, args->pgbase,
2523 args->pgbase, args->count); 2524 args->count, hdr.replen);
2524 dprintk("%s: inlined page args = (%u, %p, %u, %u)\n",
2525 __func__, hdr.replen << 2, args->pages,
2526 args->pgbase, args->count);
2527 encode_nops(&hdr); 2525 encode_nops(&hdr);
2528} 2526}
2529 2527
@@ -2543,8 +2541,8 @@ static void nfs4_xdr_enc_read(struct rpc_rqst *req, struct xdr_stream *xdr,
2543 encode_putfh(xdr, args->fh, &hdr); 2541 encode_putfh(xdr, args->fh, &hdr);
2544 encode_read(xdr, args, &hdr); 2542 encode_read(xdr, args, &hdr);
2545 2543
2546 xdr_inline_pages(&req->rq_rcv_buf, hdr.replen << 2, 2544 rpc_prepare_reply_pages(req, args->pages, args->pgbase,
2547 args->pages, args->pgbase, args->count); 2545 args->count, hdr.replen);
2548 req->rq_rcv_buf.flags |= XDRBUF_READ; 2546 req->rq_rcv_buf.flags |= XDRBUF_READ;
2549 encode_nops(&hdr); 2547 encode_nops(&hdr);
2550} 2548}
@@ -2590,9 +2588,8 @@ static void nfs4_xdr_enc_getacl(struct rpc_rqst *req, struct xdr_stream *xdr,
2590 encode_getattr(xdr, nfs4_acl_bitmap, NULL, 2588 encode_getattr(xdr, nfs4_acl_bitmap, NULL,
2591 ARRAY_SIZE(nfs4_acl_bitmap), &hdr); 2589 ARRAY_SIZE(nfs4_acl_bitmap), &hdr);
2592 2590
2593 xdr_inline_pages(&req->rq_rcv_buf, replen << 2, 2591 rpc_prepare_reply_pages(req, args->acl_pages, 0,
2594 args->acl_pages, 0, args->acl_len); 2592 args->acl_len, replen);
2595
2596 encode_nops(&hdr); 2593 encode_nops(&hdr);
2597} 2594}
2598 2595
@@ -2813,9 +2810,8 @@ static void nfs4_xdr_enc_fs_locations(struct rpc_rqst *req,
2813 encode_fs_locations(xdr, args->bitmask, &hdr); 2810 encode_fs_locations(xdr, args->bitmask, &hdr);
2814 } 2811 }
2815 2812
2816 /* Set up reply kvec to capture returned fs_locations array. */ 2813 rpc_prepare_reply_pages(req, (struct page **)&args->page, 0,
2817 xdr_inline_pages(&req->rq_rcv_buf, replen << 2, 2814 PAGE_SIZE, replen);
2818 (struct page **)&args->page, 0, PAGE_SIZE);
2819 encode_nops(&hdr); 2815 encode_nops(&hdr);
2820} 2816}
2821 2817
@@ -3017,10 +3013,8 @@ static void nfs4_xdr_enc_getdeviceinfo(struct rpc_rqst *req,
3017 3013
3018 /* set up reply kvec. Subtract notification bitmap max size (2) 3014 /* set up reply kvec. Subtract notification bitmap max size (2)
3019 * so that notification bitmap is put in xdr_buf tail */ 3015 * so that notification bitmap is put in xdr_buf tail */
3020 xdr_inline_pages(&req->rq_rcv_buf, (hdr.replen - 2) << 2, 3016 rpc_prepare_reply_pages(req, args->pdev->pages, args->pdev->pgbase,
3021 args->pdev->pages, args->pdev->pgbase, 3017 args->pdev->pglen, hdr.replen - 2);
3022 args->pdev->pglen);
3023
3024 encode_nops(&hdr); 3018 encode_nops(&hdr);
3025} 3019}
3026 3020
@@ -3041,9 +3035,8 @@ static void nfs4_xdr_enc_layoutget(struct rpc_rqst *req,
3041 encode_putfh(xdr, NFS_FH(args->inode), &hdr); 3035 encode_putfh(xdr, NFS_FH(args->inode), &hdr);
3042 encode_layoutget(xdr, args, &hdr); 3036 encode_layoutget(xdr, args, &hdr);
3043 3037
3044 xdr_inline_pages(&req->rq_rcv_buf, hdr.replen << 2, 3038 rpc_prepare_reply_pages(req, args->layout.pages, 0,
3045 args->layout.pages, 0, args->layout.pglen); 3039 args->layout.pglen, hdr.replen);
3046
3047 encode_nops(&hdr); 3040 encode_nops(&hdr);
3048} 3041}
3049 3042
@@ -3144,22 +3137,12 @@ static void nfs4_xdr_enc_free_stateid(struct rpc_rqst *req,
3144} 3137}
3145#endif /* CONFIG_NFS_V4_1 */ 3138#endif /* CONFIG_NFS_V4_1 */
3146 3139
3147static void print_overflow_msg(const char *func, const struct xdr_stream *xdr)
3148{
3149 dprintk("nfs: %s: prematurely hit end of receive buffer. "
3150 "Remaining buffer length is %tu words.\n",
3151 func, xdr->end - xdr->p);
3152}
3153
3154static int decode_opaque_inline(struct xdr_stream *xdr, unsigned int *len, char **string) 3140static int decode_opaque_inline(struct xdr_stream *xdr, unsigned int *len, char **string)
3155{ 3141{
3156 ssize_t ret = xdr_stream_decode_opaque_inline(xdr, (void **)string, 3142 ssize_t ret = xdr_stream_decode_opaque_inline(xdr, (void **)string,
3157 NFS4_OPAQUE_LIMIT); 3143 NFS4_OPAQUE_LIMIT);
3158 if (unlikely(ret < 0)) { 3144 if (unlikely(ret < 0))
3159 if (ret == -EBADMSG)
3160 print_overflow_msg(__func__, xdr);
3161 return -EIO; 3145 return -EIO;
3162 }
3163 *len = ret; 3146 *len = ret;
3164 return 0; 3147 return 0;
3165} 3148}
@@ -3170,22 +3153,19 @@ static int decode_compound_hdr(struct xdr_stream *xdr, struct compound_hdr *hdr)
3170 3153
3171 p = xdr_inline_decode(xdr, 8); 3154 p = xdr_inline_decode(xdr, 8);
3172 if (unlikely(!p)) 3155 if (unlikely(!p))
3173 goto out_overflow; 3156 return -EIO;
3174 hdr->status = be32_to_cpup(p++); 3157 hdr->status = be32_to_cpup(p++);
3175 hdr->taglen = be32_to_cpup(p); 3158 hdr->taglen = be32_to_cpup(p);
3176 3159
3177 p = xdr_inline_decode(xdr, hdr->taglen + 4); 3160 p = xdr_inline_decode(xdr, hdr->taglen + 4);
3178 if (unlikely(!p)) 3161 if (unlikely(!p))
3179 goto out_overflow; 3162 return -EIO;
3180 hdr->tag = (char *)p; 3163 hdr->tag = (char *)p;
3181 p += XDR_QUADLEN(hdr->taglen); 3164 p += XDR_QUADLEN(hdr->taglen);
3182 hdr->nops = be32_to_cpup(p); 3165 hdr->nops = be32_to_cpup(p);
3183 if (unlikely(hdr->nops < 1)) 3166 if (unlikely(hdr->nops < 1))
3184 return nfs4_stat_to_errno(hdr->status); 3167 return nfs4_stat_to_errno(hdr->status);
3185 return 0; 3168 return 0;
3186out_overflow:
3187 print_overflow_msg(__func__, xdr);
3188 return -EIO;
3189} 3169}
3190 3170
3191static bool __decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected, 3171static bool __decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected,
@@ -3201,11 +3181,14 @@ static bool __decode_op_hdr(struct xdr_stream *xdr, enum nfs_opnum4 expected,
3201 opnum = be32_to_cpup(p++); 3181 opnum = be32_to_cpup(p++);
3202 if (unlikely(opnum != expected)) 3182 if (unlikely(opnum != expected))
3203 goto out_bad_operation; 3183 goto out_bad_operation;
3184 if (unlikely(*p != cpu_to_be32(NFS_OK)))
3185 goto out_status;
3186 *nfs_retval = 0;
3187 return true;
3188out_status:
3204 nfserr = be32_to_cpup(p); 3189 nfserr = be32_to_cpup(p);
3205 if (nfserr == NFS_OK) 3190 trace_nfs4_xdr_status(opnum, nfserr);
3206 *nfs_retval = 0; 3191 *nfs_retval = nfs4_stat_to_errno(nfserr);
3207 else
3208 *nfs_retval = nfs4_stat_to_errno(nfserr);
3209 return true; 3192 return true;
3210out_bad_operation: 3193out_bad_operation:
3211 dprintk("nfs: Server returned operation" 3194 dprintk("nfs: Server returned operation"
@@ -3214,7 +3197,6 @@ out_bad_operation:
3214 *nfs_retval = -EREMOTEIO; 3197 *nfs_retval = -EREMOTEIO;
3215 return false; 3198 return false;
3216out_overflow: 3199out_overflow:
3217 print_overflow_msg(__func__, xdr);
3218 *nfs_retval = -EIO; 3200 *nfs_retval = -EIO;
3219 return false; 3201 return false;
3220} 3202}
@@ -3235,10 +3217,9 @@ static int decode_ace(struct xdr_stream *xdr, void *ace)
3235 char *str; 3217 char *str;
3236 3218
3237 p = xdr_inline_decode(xdr, 12); 3219 p = xdr_inline_decode(xdr, 12);
3238 if (likely(p)) 3220 if (unlikely(!p))
3239 return decode_opaque_inline(xdr, &strlen, &str); 3221 return -EIO;
3240 print_overflow_msg(__func__, xdr); 3222 return decode_opaque_inline(xdr, &strlen, &str);
3241 return -EIO;
3242} 3223}
3243 3224
3244static ssize_t 3225static ssize_t
@@ -3249,10 +3230,9 @@ decode_bitmap4(struct xdr_stream *xdr, uint32_t *bitmap, size_t sz)
3249 ret = xdr_stream_decode_uint32_array(xdr, bitmap, sz); 3230 ret = xdr_stream_decode_uint32_array(xdr, bitmap, sz);
3250 if (likely(ret >= 0)) 3231 if (likely(ret >= 0))
3251 return ret; 3232 return ret;
3252 if (ret == -EMSGSIZE) 3233 if (ret != -EMSGSIZE)
3253 return sz; 3234 return -EIO;
3254 print_overflow_msg(__func__, xdr); 3235 return sz;
3255 return -EIO;
3256} 3236}
3257 3237
3258static int decode_attr_bitmap(struct xdr_stream *xdr, uint32_t *bitmap) 3238static int decode_attr_bitmap(struct xdr_stream *xdr, uint32_t *bitmap)
@@ -3268,13 +3248,10 @@ static int decode_attr_length(struct xdr_stream *xdr, uint32_t *attrlen, unsigne
3268 3248
3269 p = xdr_inline_decode(xdr, 4); 3249 p = xdr_inline_decode(xdr, 4);
3270 if (unlikely(!p)) 3250 if (unlikely(!p))
3271 goto out_overflow; 3251 return -EIO;
3272 *attrlen = be32_to_cpup(p); 3252 *attrlen = be32_to_cpup(p);
3273 *savep = xdr_stream_pos(xdr); 3253 *savep = xdr_stream_pos(xdr);
3274 return 0; 3254 return 0;
3275out_overflow:
3276 print_overflow_msg(__func__, xdr);
3277 return -EIO;
3278} 3255}
3279 3256
3280static int decode_attr_supported(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *bitmask) 3257static int decode_attr_supported(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *bitmask)
@@ -3303,7 +3280,7 @@ static int decode_attr_type(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *
3303 if (likely(bitmap[0] & FATTR4_WORD0_TYPE)) { 3280 if (likely(bitmap[0] & FATTR4_WORD0_TYPE)) {
3304 p = xdr_inline_decode(xdr, 4); 3281 p = xdr_inline_decode(xdr, 4);
3305 if (unlikely(!p)) 3282 if (unlikely(!p))
3306 goto out_overflow; 3283 return -EIO;
3307 *type = be32_to_cpup(p); 3284 *type = be32_to_cpup(p);
3308 if (*type < NF4REG || *type > NF4NAMEDATTR) { 3285 if (*type < NF4REG || *type > NF4NAMEDATTR) {
3309 dprintk("%s: bad type %d\n", __func__, *type); 3286 dprintk("%s: bad type %d\n", __func__, *type);
@@ -3314,9 +3291,6 @@ static int decode_attr_type(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *
3314 } 3291 }
3315 dprintk("%s: type=0%o\n", __func__, nfs_type2fmt[*type]); 3292 dprintk("%s: type=0%o\n", __func__, nfs_type2fmt[*type]);
3316 return ret; 3293 return ret;
3317out_overflow:
3318 print_overflow_msg(__func__, xdr);
3319 return -EIO;
3320} 3294}
3321 3295
3322static int decode_attr_fh_expire_type(struct xdr_stream *xdr, 3296static int decode_attr_fh_expire_type(struct xdr_stream *xdr,
@@ -3330,15 +3304,12 @@ static int decode_attr_fh_expire_type(struct xdr_stream *xdr,
3330 if (likely(bitmap[0] & FATTR4_WORD0_FH_EXPIRE_TYPE)) { 3304 if (likely(bitmap[0] & FATTR4_WORD0_FH_EXPIRE_TYPE)) {
3331 p = xdr_inline_decode(xdr, 4); 3305 p = xdr_inline_decode(xdr, 4);
3332 if (unlikely(!p)) 3306 if (unlikely(!p))
3333 goto out_overflow; 3307 return -EIO;
3334 *type = be32_to_cpup(p); 3308 *type = be32_to_cpup(p);
3335 bitmap[0] &= ~FATTR4_WORD0_FH_EXPIRE_TYPE; 3309 bitmap[0] &= ~FATTR4_WORD0_FH_EXPIRE_TYPE;
3336 } 3310 }
3337 dprintk("%s: expire type=0x%x\n", __func__, *type); 3311 dprintk("%s: expire type=0x%x\n", __func__, *type);
3338 return 0; 3312 return 0;
3339out_overflow:
3340 print_overflow_msg(__func__, xdr);
3341 return -EIO;
3342} 3313}
3343 3314
3344static int decode_attr_change(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *change) 3315static int decode_attr_change(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *change)
@@ -3352,7 +3323,7 @@ static int decode_attr_change(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t
3352 if (likely(bitmap[0] & FATTR4_WORD0_CHANGE)) { 3323 if (likely(bitmap[0] & FATTR4_WORD0_CHANGE)) {
3353 p = xdr_inline_decode(xdr, 8); 3324 p = xdr_inline_decode(xdr, 8);
3354 if (unlikely(!p)) 3325 if (unlikely(!p))
3355 goto out_overflow; 3326 return -EIO;
3356 xdr_decode_hyper(p, change); 3327 xdr_decode_hyper(p, change);
3357 bitmap[0] &= ~FATTR4_WORD0_CHANGE; 3328 bitmap[0] &= ~FATTR4_WORD0_CHANGE;
3358 ret = NFS_ATTR_FATTR_CHANGE; 3329 ret = NFS_ATTR_FATTR_CHANGE;
@@ -3360,9 +3331,6 @@ static int decode_attr_change(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t
3360 dprintk("%s: change attribute=%Lu\n", __func__, 3331 dprintk("%s: change attribute=%Lu\n", __func__,
3361 (unsigned long long)*change); 3332 (unsigned long long)*change);
3362 return ret; 3333 return ret;
3363out_overflow:
3364 print_overflow_msg(__func__, xdr);
3365 return -EIO;
3366} 3334}
3367 3335
3368static int decode_attr_size(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *size) 3336static int decode_attr_size(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *size)
@@ -3376,16 +3344,13 @@ static int decode_attr_size(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *
3376 if (likely(bitmap[0] & FATTR4_WORD0_SIZE)) { 3344 if (likely(bitmap[0] & FATTR4_WORD0_SIZE)) {
3377 p = xdr_inline_decode(xdr, 8); 3345 p = xdr_inline_decode(xdr, 8);
3378 if (unlikely(!p)) 3346 if (unlikely(!p))
3379 goto out_overflow; 3347 return -EIO;
3380 xdr_decode_hyper(p, size); 3348 xdr_decode_hyper(p, size);
3381 bitmap[0] &= ~FATTR4_WORD0_SIZE; 3349 bitmap[0] &= ~FATTR4_WORD0_SIZE;
3382 ret = NFS_ATTR_FATTR_SIZE; 3350 ret = NFS_ATTR_FATTR_SIZE;
3383 } 3351 }
3384 dprintk("%s: file size=%Lu\n", __func__, (unsigned long long)*size); 3352 dprintk("%s: file size=%Lu\n", __func__, (unsigned long long)*size);
3385 return ret; 3353 return ret;
3386out_overflow:
3387 print_overflow_msg(__func__, xdr);
3388 return -EIO;
3389} 3354}
3390 3355
3391static int decode_attr_link_support(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) 3356static int decode_attr_link_support(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res)
@@ -3398,15 +3363,12 @@ static int decode_attr_link_support(struct xdr_stream *xdr, uint32_t *bitmap, ui
3398 if (likely(bitmap[0] & FATTR4_WORD0_LINK_SUPPORT)) { 3363 if (likely(bitmap[0] & FATTR4_WORD0_LINK_SUPPORT)) {
3399 p = xdr_inline_decode(xdr, 4); 3364 p = xdr_inline_decode(xdr, 4);
3400 if (unlikely(!p)) 3365 if (unlikely(!p))
3401 goto out_overflow; 3366 return -EIO;
3402 *res = be32_to_cpup(p); 3367 *res = be32_to_cpup(p);
3403 bitmap[0] &= ~FATTR4_WORD0_LINK_SUPPORT; 3368 bitmap[0] &= ~FATTR4_WORD0_LINK_SUPPORT;
3404 } 3369 }
3405 dprintk("%s: link support=%s\n", __func__, *res == 0 ? "false" : "true"); 3370 dprintk("%s: link support=%s\n", __func__, *res == 0 ? "false" : "true");
3406 return 0; 3371 return 0;
3407out_overflow:
3408 print_overflow_msg(__func__, xdr);
3409 return -EIO;
3410} 3372}
3411 3373
3412static int decode_attr_symlink_support(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) 3374static int decode_attr_symlink_support(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res)
@@ -3419,15 +3381,12 @@ static int decode_attr_symlink_support(struct xdr_stream *xdr, uint32_t *bitmap,
3419 if (likely(bitmap[0] & FATTR4_WORD0_SYMLINK_SUPPORT)) { 3381 if (likely(bitmap[0] & FATTR4_WORD0_SYMLINK_SUPPORT)) {
3420 p = xdr_inline_decode(xdr, 4); 3382 p = xdr_inline_decode(xdr, 4);
3421 if (unlikely(!p)) 3383 if (unlikely(!p))
3422 goto out_overflow; 3384 return -EIO;
3423 *res = be32_to_cpup(p); 3385 *res = be32_to_cpup(p);
3424 bitmap[0] &= ~FATTR4_WORD0_SYMLINK_SUPPORT; 3386 bitmap[0] &= ~FATTR4_WORD0_SYMLINK_SUPPORT;
3425 } 3387 }
3426 dprintk("%s: symlink support=%s\n", __func__, *res == 0 ? "false" : "true"); 3388 dprintk("%s: symlink support=%s\n", __func__, *res == 0 ? "false" : "true");
3427 return 0; 3389 return 0;
3428out_overflow:
3429 print_overflow_msg(__func__, xdr);
3430 return -EIO;
3431} 3390}
3432 3391
3433static int decode_attr_fsid(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_fsid *fsid) 3392static int decode_attr_fsid(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs_fsid *fsid)
@@ -3442,7 +3401,7 @@ static int decode_attr_fsid(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs
3442 if (likely(bitmap[0] & FATTR4_WORD0_FSID)) { 3401 if (likely(bitmap[0] & FATTR4_WORD0_FSID)) {
3443 p = xdr_inline_decode(xdr, 16); 3402 p = xdr_inline_decode(xdr, 16);
3444 if (unlikely(!p)) 3403 if (unlikely(!p))
3445 goto out_overflow; 3404 return -EIO;
3446 p = xdr_decode_hyper(p, &fsid->major); 3405 p = xdr_decode_hyper(p, &fsid->major);
3447 xdr_decode_hyper(p, &fsid->minor); 3406 xdr_decode_hyper(p, &fsid->minor);
3448 bitmap[0] &= ~FATTR4_WORD0_FSID; 3407 bitmap[0] &= ~FATTR4_WORD0_FSID;
@@ -3452,9 +3411,6 @@ static int decode_attr_fsid(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs
3452 (unsigned long long)fsid->major, 3411 (unsigned long long)fsid->major,
3453 (unsigned long long)fsid->minor); 3412 (unsigned long long)fsid->minor);
3454 return ret; 3413 return ret;
3455out_overflow:
3456 print_overflow_msg(__func__, xdr);
3457 return -EIO;
3458} 3414}
3459 3415
3460static int decode_attr_lease_time(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) 3416static int decode_attr_lease_time(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res)
@@ -3467,15 +3423,12 @@ static int decode_attr_lease_time(struct xdr_stream *xdr, uint32_t *bitmap, uint
3467 if (likely(bitmap[0] & FATTR4_WORD0_LEASE_TIME)) { 3423 if (likely(bitmap[0] & FATTR4_WORD0_LEASE_TIME)) {
3468 p = xdr_inline_decode(xdr, 4); 3424 p = xdr_inline_decode(xdr, 4);
3469 if (unlikely(!p)) 3425 if (unlikely(!p))
3470 goto out_overflow; 3426 return -EIO;
3471 *res = be32_to_cpup(p); 3427 *res = be32_to_cpup(p);
3472 bitmap[0] &= ~FATTR4_WORD0_LEASE_TIME; 3428 bitmap[0] &= ~FATTR4_WORD0_LEASE_TIME;
3473 } 3429 }
3474 dprintk("%s: file size=%u\n", __func__, (unsigned int)*res); 3430 dprintk("%s: file size=%u\n", __func__, (unsigned int)*res);
3475 return 0; 3431 return 0;
3476out_overflow:
3477 print_overflow_msg(__func__, xdr);
3478 return -EIO;
3479} 3432}
3480 3433
3481static int decode_attr_error(struct xdr_stream *xdr, uint32_t *bitmap, int32_t *res) 3434static int decode_attr_error(struct xdr_stream *xdr, uint32_t *bitmap, int32_t *res)
@@ -3487,14 +3440,11 @@ static int decode_attr_error(struct xdr_stream *xdr, uint32_t *bitmap, int32_t *
3487 if (likely(bitmap[0] & FATTR4_WORD0_RDATTR_ERROR)) { 3440 if (likely(bitmap[0] & FATTR4_WORD0_RDATTR_ERROR)) {
3488 p = xdr_inline_decode(xdr, 4); 3441 p = xdr_inline_decode(xdr, 4);
3489 if (unlikely(!p)) 3442 if (unlikely(!p))
3490 goto out_overflow; 3443 return -EIO;
3491 bitmap[0] &= ~FATTR4_WORD0_RDATTR_ERROR; 3444 bitmap[0] &= ~FATTR4_WORD0_RDATTR_ERROR;
3492 *res = -be32_to_cpup(p); 3445 *res = -be32_to_cpup(p);
3493 } 3446 }
3494 return 0; 3447 return 0;
3495out_overflow:
3496 print_overflow_msg(__func__, xdr);
3497 return -EIO;
3498} 3448}
3499 3449
3500static int decode_attr_exclcreat_supported(struct xdr_stream *xdr, 3450static int decode_attr_exclcreat_supported(struct xdr_stream *xdr,
@@ -3526,13 +3476,13 @@ static int decode_attr_filehandle(struct xdr_stream *xdr, uint32_t *bitmap, stru
3526 if (likely(bitmap[0] & FATTR4_WORD0_FILEHANDLE)) { 3476 if (likely(bitmap[0] & FATTR4_WORD0_FILEHANDLE)) {
3527 p = xdr_inline_decode(xdr, 4); 3477 p = xdr_inline_decode(xdr, 4);
3528 if (unlikely(!p)) 3478 if (unlikely(!p))
3529 goto out_overflow; 3479 return -EIO;
3530 len = be32_to_cpup(p); 3480 len = be32_to_cpup(p);
3531 if (len > NFS4_FHSIZE) 3481 if (len > NFS4_FHSIZE)
3532 return -EIO; 3482 return -EIO;
3533 p = xdr_inline_decode(xdr, len); 3483 p = xdr_inline_decode(xdr, len);
3534 if (unlikely(!p)) 3484 if (unlikely(!p))
3535 goto out_overflow; 3485 return -EIO;
3536 if (fh != NULL) { 3486 if (fh != NULL) {
3537 memcpy(fh->data, p, len); 3487 memcpy(fh->data, p, len);
3538 fh->size = len; 3488 fh->size = len;
@@ -3540,9 +3490,6 @@ static int decode_attr_filehandle(struct xdr_stream *xdr, uint32_t *bitmap, stru
3540 bitmap[0] &= ~FATTR4_WORD0_FILEHANDLE; 3490 bitmap[0] &= ~FATTR4_WORD0_FILEHANDLE;
3541 } 3491 }
3542 return 0; 3492 return 0;
3543out_overflow:
3544 print_overflow_msg(__func__, xdr);
3545 return -EIO;
3546} 3493}
3547 3494
3548static int decode_attr_aclsupport(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) 3495static int decode_attr_aclsupport(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res)
@@ -3555,15 +3502,12 @@ static int decode_attr_aclsupport(struct xdr_stream *xdr, uint32_t *bitmap, uint
3555 if (likely(bitmap[0] & FATTR4_WORD0_ACLSUPPORT)) { 3502 if (likely(bitmap[0] & FATTR4_WORD0_ACLSUPPORT)) {
3556 p = xdr_inline_decode(xdr, 4); 3503 p = xdr_inline_decode(xdr, 4);
3557 if (unlikely(!p)) 3504 if (unlikely(!p))
3558 goto out_overflow; 3505 return -EIO;
3559 *res = be32_to_cpup(p); 3506 *res = be32_to_cpup(p);
3560 bitmap[0] &= ~FATTR4_WORD0_ACLSUPPORT; 3507 bitmap[0] &= ~FATTR4_WORD0_ACLSUPPORT;
3561 } 3508 }
3562 dprintk("%s: ACLs supported=%u\n", __func__, (unsigned int)*res); 3509 dprintk("%s: ACLs supported=%u\n", __func__, (unsigned int)*res);
3563 return 0; 3510 return 0;
3564out_overflow:
3565 print_overflow_msg(__func__, xdr);
3566 return -EIO;
3567} 3511}
3568 3512
3569static int decode_attr_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *fileid) 3513static int decode_attr_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *fileid)
@@ -3577,16 +3521,13 @@ static int decode_attr_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t
3577 if (likely(bitmap[0] & FATTR4_WORD0_FILEID)) { 3521 if (likely(bitmap[0] & FATTR4_WORD0_FILEID)) {
3578 p = xdr_inline_decode(xdr, 8); 3522 p = xdr_inline_decode(xdr, 8);
3579 if (unlikely(!p)) 3523 if (unlikely(!p))
3580 goto out_overflow; 3524 return -EIO;
3581 xdr_decode_hyper(p, fileid); 3525 xdr_decode_hyper(p, fileid);
3582 bitmap[0] &= ~FATTR4_WORD0_FILEID; 3526 bitmap[0] &= ~FATTR4_WORD0_FILEID;
3583 ret = NFS_ATTR_FATTR_FILEID; 3527 ret = NFS_ATTR_FATTR_FILEID;
3584 } 3528 }
3585 dprintk("%s: fileid=%Lu\n", __func__, (unsigned long long)*fileid); 3529 dprintk("%s: fileid=%Lu\n", __func__, (unsigned long long)*fileid);
3586 return ret; 3530 return ret;
3587out_overflow:
3588 print_overflow_msg(__func__, xdr);
3589 return -EIO;
3590} 3531}
3591 3532
3592static int decode_attr_mounted_on_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *fileid) 3533static int decode_attr_mounted_on_fileid(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *fileid)
@@ -3600,16 +3541,13 @@ static int decode_attr_mounted_on_fileid(struct xdr_stream *xdr, uint32_t *bitma
3600 if (likely(bitmap[1] & FATTR4_WORD1_MOUNTED_ON_FILEID)) { 3541 if (likely(bitmap[1] & FATTR4_WORD1_MOUNTED_ON_FILEID)) {
3601 p = xdr_inline_decode(xdr, 8); 3542 p = xdr_inline_decode(xdr, 8);
3602 if (unlikely(!p)) 3543 if (unlikely(!p))
3603 goto out_overflow; 3544 return -EIO;
3604 xdr_decode_hyper(p, fileid); 3545 xdr_decode_hyper(p, fileid);
3605 bitmap[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID; 3546 bitmap[1] &= ~FATTR4_WORD1_MOUNTED_ON_FILEID;
3606 ret = NFS_ATTR_FATTR_MOUNTED_ON_FILEID; 3547 ret = NFS_ATTR_FATTR_MOUNTED_ON_FILEID;
3607 } 3548 }
3608 dprintk("%s: fileid=%Lu\n", __func__, (unsigned long long)*fileid); 3549 dprintk("%s: fileid=%Lu\n", __func__, (unsigned long long)*fileid);
3609 return ret; 3550 return ret;
3610out_overflow:
3611 print_overflow_msg(__func__, xdr);
3612 return -EIO;
3613} 3551}
3614 3552
3615static int decode_attr_files_avail(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) 3553static int decode_attr_files_avail(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res)
@@ -3623,15 +3561,12 @@ static int decode_attr_files_avail(struct xdr_stream *xdr, uint32_t *bitmap, uin
3623 if (likely(bitmap[0] & FATTR4_WORD0_FILES_AVAIL)) { 3561 if (likely(bitmap[0] & FATTR4_WORD0_FILES_AVAIL)) {
3624 p = xdr_inline_decode(xdr, 8); 3562 p = xdr_inline_decode(xdr, 8);
3625 if (unlikely(!p)) 3563 if (unlikely(!p))
3626 goto out_overflow; 3564 return -EIO;
3627 xdr_decode_hyper(p, res); 3565 xdr_decode_hyper(p, res);
3628 bitmap[0] &= ~FATTR4_WORD0_FILES_AVAIL; 3566 bitmap[0] &= ~FATTR4_WORD0_FILES_AVAIL;
3629 } 3567 }
3630 dprintk("%s: files avail=%Lu\n", __func__, (unsigned long long)*res); 3568 dprintk("%s: files avail=%Lu\n", __func__, (unsigned long long)*res);
3631 return status; 3569 return status;
3632out_overflow:
3633 print_overflow_msg(__func__, xdr);
3634 return -EIO;
3635} 3570}
3636 3571
3637static int decode_attr_files_free(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) 3572static int decode_attr_files_free(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res)
@@ -3645,15 +3580,12 @@ static int decode_attr_files_free(struct xdr_stream *xdr, uint32_t *bitmap, uint
3645 if (likely(bitmap[0] & FATTR4_WORD0_FILES_FREE)) { 3580 if (likely(bitmap[0] & FATTR4_WORD0_FILES_FREE)) {
3646 p = xdr_inline_decode(xdr, 8); 3581 p = xdr_inline_decode(xdr, 8);
3647 if (unlikely(!p)) 3582 if (unlikely(!p))
3648 goto out_overflow; 3583 return -EIO;
3649 xdr_decode_hyper(p, res); 3584 xdr_decode_hyper(p, res);
3650 bitmap[0] &= ~FATTR4_WORD0_FILES_FREE; 3585 bitmap[0] &= ~FATTR4_WORD0_FILES_FREE;
3651 } 3586 }
3652 dprintk("%s: files free=%Lu\n", __func__, (unsigned long long)*res); 3587 dprintk("%s: files free=%Lu\n", __func__, (unsigned long long)*res);
3653 return status; 3588 return status;
3654out_overflow:
3655 print_overflow_msg(__func__, xdr);
3656 return -EIO;
3657} 3589}
3658 3590
3659static int decode_attr_files_total(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) 3591static int decode_attr_files_total(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res)
@@ -3667,15 +3599,12 @@ static int decode_attr_files_total(struct xdr_stream *xdr, uint32_t *bitmap, uin
3667 if (likely(bitmap[0] & FATTR4_WORD0_FILES_TOTAL)) { 3599 if (likely(bitmap[0] & FATTR4_WORD0_FILES_TOTAL)) {
3668 p = xdr_inline_decode(xdr, 8); 3600 p = xdr_inline_decode(xdr, 8);
3669 if (unlikely(!p)) 3601 if (unlikely(!p))
3670 goto out_overflow; 3602 return -EIO;
3671 xdr_decode_hyper(p, res); 3603 xdr_decode_hyper(p, res);
3672 bitmap[0] &= ~FATTR4_WORD0_FILES_TOTAL; 3604 bitmap[0] &= ~FATTR4_WORD0_FILES_TOTAL;
3673 } 3605 }
3674 dprintk("%s: files total=%Lu\n", __func__, (unsigned long long)*res); 3606 dprintk("%s: files total=%Lu\n", __func__, (unsigned long long)*res);
3675 return status; 3607 return status;
3676out_overflow:
3677 print_overflow_msg(__func__, xdr);
3678 return -EIO;
3679} 3608}
3680 3609
3681static int decode_pathname(struct xdr_stream *xdr, struct nfs4_pathname *path) 3610static int decode_pathname(struct xdr_stream *xdr, struct nfs4_pathname *path)
@@ -3686,7 +3615,7 @@ static int decode_pathname(struct xdr_stream *xdr, struct nfs4_pathname *path)
3686 3615
3687 p = xdr_inline_decode(xdr, 4); 3616 p = xdr_inline_decode(xdr, 4);
3688 if (unlikely(!p)) 3617 if (unlikely(!p))
3689 goto out_overflow; 3618 return -EIO;
3690 n = be32_to_cpup(p); 3619 n = be32_to_cpup(p);
3691 if (n == 0) 3620 if (n == 0)
3692 goto root_path; 3621 goto root_path;
@@ -3718,9 +3647,6 @@ out_eio:
3718 dprintk(" status %d", status); 3647 dprintk(" status %d", status);
3719 status = -EIO; 3648 status = -EIO;
3720 goto out; 3649 goto out;
3721out_overflow:
3722 print_overflow_msg(__func__, xdr);
3723 return -EIO;
3724} 3650}
3725 3651
3726static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs4_fs_locations *res) 3652static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, struct nfs4_fs_locations *res)
@@ -3745,7 +3671,7 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, st
3745 goto out; 3671 goto out;
3746 p = xdr_inline_decode(xdr, 4); 3672 p = xdr_inline_decode(xdr, 4);
3747 if (unlikely(!p)) 3673 if (unlikely(!p))
3748 goto out_overflow; 3674 goto out_eio;
3749 n = be32_to_cpup(p); 3675 n = be32_to_cpup(p);
3750 if (n <= 0) 3676 if (n <= 0)
3751 goto out_eio; 3677 goto out_eio;
@@ -3758,7 +3684,7 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, st
3758 loc = &res->locations[res->nlocations]; 3684 loc = &res->locations[res->nlocations];
3759 p = xdr_inline_decode(xdr, 4); 3685 p = xdr_inline_decode(xdr, 4);
3760 if (unlikely(!p)) 3686 if (unlikely(!p))
3761 goto out_overflow; 3687 goto out_eio;
3762 m = be32_to_cpup(p); 3688 m = be32_to_cpup(p);
3763 3689
3764 dprintk("%s: servers:\n", __func__); 3690 dprintk("%s: servers:\n", __func__);
@@ -3796,8 +3722,6 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, st
3796out: 3722out:
3797 dprintk("%s: fs_locations done, error = %d\n", __func__, status); 3723 dprintk("%s: fs_locations done, error = %d\n", __func__, status);
3798 return status; 3724 return status;
3799out_overflow:
3800 print_overflow_msg(__func__, xdr);
3801out_eio: 3725out_eio:
3802 status = -EIO; 3726 status = -EIO;
3803 goto out; 3727 goto out;
@@ -3814,15 +3738,12 @@ static int decode_attr_maxfilesize(struct xdr_stream *xdr, uint32_t *bitmap, uin
3814 if (likely(bitmap[0] & FATTR4_WORD0_MAXFILESIZE)) { 3738 if (likely(bitmap[0] & FATTR4_WORD0_MAXFILESIZE)) {
3815 p = xdr_inline_decode(xdr, 8); 3739 p = xdr_inline_decode(xdr, 8);
3816 if (unlikely(!p)) 3740 if (unlikely(!p))
3817 goto out_overflow; 3741 return -EIO;
3818 xdr_decode_hyper(p, res); 3742 xdr_decode_hyper(p, res);
3819 bitmap[0] &= ~FATTR4_WORD0_MAXFILESIZE; 3743 bitmap[0] &= ~FATTR4_WORD0_MAXFILESIZE;
3820 } 3744 }
3821 dprintk("%s: maxfilesize=%Lu\n", __func__, (unsigned long long)*res); 3745 dprintk("%s: maxfilesize=%Lu\n", __func__, (unsigned long long)*res);
3822 return status; 3746 return status;
3823out_overflow:
3824 print_overflow_msg(__func__, xdr);
3825 return -EIO;
3826} 3747}
3827 3748
3828static int decode_attr_maxlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *maxlink) 3749static int decode_attr_maxlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *maxlink)
@@ -3836,15 +3757,12 @@ static int decode_attr_maxlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_
3836 if (likely(bitmap[0] & FATTR4_WORD0_MAXLINK)) { 3757 if (likely(bitmap[0] & FATTR4_WORD0_MAXLINK)) {
3837 p = xdr_inline_decode(xdr, 4); 3758 p = xdr_inline_decode(xdr, 4);
3838 if (unlikely(!p)) 3759 if (unlikely(!p))
3839 goto out_overflow; 3760 return -EIO;
3840 *maxlink = be32_to_cpup(p); 3761 *maxlink = be32_to_cpup(p);
3841 bitmap[0] &= ~FATTR4_WORD0_MAXLINK; 3762 bitmap[0] &= ~FATTR4_WORD0_MAXLINK;
3842 } 3763 }
3843 dprintk("%s: maxlink=%u\n", __func__, *maxlink); 3764 dprintk("%s: maxlink=%u\n", __func__, *maxlink);
3844 return status; 3765 return status;
3845out_overflow:
3846 print_overflow_msg(__func__, xdr);
3847 return -EIO;
3848} 3766}
3849 3767
3850static int decode_attr_maxname(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *maxname) 3768static int decode_attr_maxname(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *maxname)
@@ -3858,15 +3776,12 @@ static int decode_attr_maxname(struct xdr_stream *xdr, uint32_t *bitmap, uint32_
3858 if (likely(bitmap[0] & FATTR4_WORD0_MAXNAME)) { 3776 if (likely(bitmap[0] & FATTR4_WORD0_MAXNAME)) {
3859 p = xdr_inline_decode(xdr, 4); 3777 p = xdr_inline_decode(xdr, 4);
3860 if (unlikely(!p)) 3778 if (unlikely(!p))
3861 goto out_overflow; 3779 return -EIO;
3862 *maxname = be32_to_cpup(p); 3780 *maxname = be32_to_cpup(p);
3863 bitmap[0] &= ~FATTR4_WORD0_MAXNAME; 3781 bitmap[0] &= ~FATTR4_WORD0_MAXNAME;
3864 } 3782 }
3865 dprintk("%s: maxname=%u\n", __func__, *maxname); 3783 dprintk("%s: maxname=%u\n", __func__, *maxname);
3866 return status; 3784 return status;
3867out_overflow:
3868 print_overflow_msg(__func__, xdr);
3869 return -EIO;
3870} 3785}
3871 3786
3872static int decode_attr_maxread(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) 3787static int decode_attr_maxread(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res)
@@ -3881,7 +3796,7 @@ static int decode_attr_maxread(struct xdr_stream *xdr, uint32_t *bitmap, uint32_
3881 uint64_t maxread; 3796 uint64_t maxread;
3882 p = xdr_inline_decode(xdr, 8); 3797 p = xdr_inline_decode(xdr, 8);
3883 if (unlikely(!p)) 3798 if (unlikely(!p))
3884 goto out_overflow; 3799 return -EIO;
3885 xdr_decode_hyper(p, &maxread); 3800 xdr_decode_hyper(p, &maxread);
3886 if (maxread > 0x7FFFFFFF) 3801 if (maxread > 0x7FFFFFFF)
3887 maxread = 0x7FFFFFFF; 3802 maxread = 0x7FFFFFFF;
@@ -3890,9 +3805,6 @@ static int decode_attr_maxread(struct xdr_stream *xdr, uint32_t *bitmap, uint32_
3890 } 3805 }
3891 dprintk("%s: maxread=%lu\n", __func__, (unsigned long)*res); 3806 dprintk("%s: maxread=%lu\n", __func__, (unsigned long)*res);
3892 return status; 3807 return status;
3893out_overflow:
3894 print_overflow_msg(__func__, xdr);
3895 return -EIO;
3896} 3808}
3897 3809
3898static int decode_attr_maxwrite(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res) 3810static int decode_attr_maxwrite(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *res)
@@ -3907,7 +3819,7 @@ static int decode_attr_maxwrite(struct xdr_stream *xdr, uint32_t *bitmap, uint32
3907 uint64_t maxwrite; 3819 uint64_t maxwrite;
3908 p = xdr_inline_decode(xdr, 8); 3820 p = xdr_inline_decode(xdr, 8);
3909 if (unlikely(!p)) 3821 if (unlikely(!p))
3910 goto out_overflow; 3822 return -EIO;
3911 xdr_decode_hyper(p, &maxwrite); 3823 xdr_decode_hyper(p, &maxwrite);
3912 if (maxwrite > 0x7FFFFFFF) 3824 if (maxwrite > 0x7FFFFFFF)
3913 maxwrite = 0x7FFFFFFF; 3825 maxwrite = 0x7FFFFFFF;
@@ -3916,9 +3828,6 @@ static int decode_attr_maxwrite(struct xdr_stream *xdr, uint32_t *bitmap, uint32
3916 } 3828 }
3917 dprintk("%s: maxwrite=%lu\n", __func__, (unsigned long)*res); 3829 dprintk("%s: maxwrite=%lu\n", __func__, (unsigned long)*res);
3918 return status; 3830 return status;
3919out_overflow:
3920 print_overflow_msg(__func__, xdr);
3921 return -EIO;
3922} 3831}
3923 3832
3924static int decode_attr_mode(struct xdr_stream *xdr, uint32_t *bitmap, umode_t *mode) 3833static int decode_attr_mode(struct xdr_stream *xdr, uint32_t *bitmap, umode_t *mode)
@@ -3933,7 +3842,7 @@ static int decode_attr_mode(struct xdr_stream *xdr, uint32_t *bitmap, umode_t *m
3933 if (likely(bitmap[1] & FATTR4_WORD1_MODE)) { 3842 if (likely(bitmap[1] & FATTR4_WORD1_MODE)) {
3934 p = xdr_inline_decode(xdr, 4); 3843 p = xdr_inline_decode(xdr, 4);
3935 if (unlikely(!p)) 3844 if (unlikely(!p))
3936 goto out_overflow; 3845 return -EIO;
3937 tmp = be32_to_cpup(p); 3846 tmp = be32_to_cpup(p);
3938 *mode = tmp & ~S_IFMT; 3847 *mode = tmp & ~S_IFMT;
3939 bitmap[1] &= ~FATTR4_WORD1_MODE; 3848 bitmap[1] &= ~FATTR4_WORD1_MODE;
@@ -3941,9 +3850,6 @@ static int decode_attr_mode(struct xdr_stream *xdr, uint32_t *bitmap, umode_t *m
3941 } 3850 }
3942 dprintk("%s: file mode=0%o\n", __func__, (unsigned int)*mode); 3851 dprintk("%s: file mode=0%o\n", __func__, (unsigned int)*mode);
3943 return ret; 3852 return ret;
3944out_overflow:
3945 print_overflow_msg(__func__, xdr);
3946 return -EIO;
3947} 3853}
3948 3854
3949static int decode_attr_nlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *nlink) 3855static int decode_attr_nlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t *nlink)
@@ -3957,16 +3863,13 @@ static int decode_attr_nlink(struct xdr_stream *xdr, uint32_t *bitmap, uint32_t
3957 if (likely(bitmap[1] & FATTR4_WORD1_NUMLINKS)) { 3863 if (likely(bitmap[1] & FATTR4_WORD1_NUMLINKS)) {
3958 p = xdr_inline_decode(xdr, 4); 3864 p = xdr_inline_decode(xdr, 4);
3959 if (unlikely(!p)) 3865 if (unlikely(!p))
3960 goto out_overflow; 3866 return -EIO;
3961 *nlink = be32_to_cpup(p); 3867 *nlink = be32_to_cpup(p);
3962 bitmap[1] &= ~FATTR4_WORD1_NUMLINKS; 3868 bitmap[1] &= ~FATTR4_WORD1_NUMLINKS;
3963 ret = NFS_ATTR_FATTR_NLINK; 3869 ret = NFS_ATTR_FATTR_NLINK;
3964 } 3870 }
3965 dprintk("%s: nlink=%u\n", __func__, (unsigned int)*nlink); 3871 dprintk("%s: nlink=%u\n", __func__, (unsigned int)*nlink);
3966 return ret; 3872 return ret;
3967out_overflow:
3968 print_overflow_msg(__func__, xdr);
3969 return -EIO;
3970} 3873}
3971 3874
3972static ssize_t decode_nfs4_string(struct xdr_stream *xdr, 3875static ssize_t decode_nfs4_string(struct xdr_stream *xdr,
@@ -4011,10 +3914,9 @@ static int decode_attr_owner(struct xdr_stream *xdr, uint32_t *bitmap,
4011 return NFS_ATTR_FATTR_OWNER; 3914 return NFS_ATTR_FATTR_OWNER;
4012 } 3915 }
4013out: 3916out:
4014 if (len != -EBADMSG) 3917 if (len == -EBADMSG)
4015 return 0; 3918 return -EIO;
4016 print_overflow_msg(__func__, xdr); 3919 return 0;
4017 return -EIO;
4018} 3920}
4019 3921
4020static int decode_attr_group(struct xdr_stream *xdr, uint32_t *bitmap, 3922static int decode_attr_group(struct xdr_stream *xdr, uint32_t *bitmap,
@@ -4046,10 +3948,9 @@ static int decode_attr_group(struct xdr_stream *xdr, uint32_t *bitmap,
4046 return NFS_ATTR_FATTR_GROUP; 3948 return NFS_ATTR_FATTR_GROUP;
4047 } 3949 }
4048out: 3950out:
4049 if (len != -EBADMSG) 3951 if (len == -EBADMSG)
4050 return 0; 3952 return -EIO;
4051 print_overflow_msg(__func__, xdr); 3953 return 0;
4052 return -EIO;
4053} 3954}
4054 3955
4055static int decode_attr_rdev(struct xdr_stream *xdr, uint32_t *bitmap, dev_t *rdev) 3956static int decode_attr_rdev(struct xdr_stream *xdr, uint32_t *bitmap, dev_t *rdev)
@@ -4066,7 +3967,7 @@ static int decode_attr_rdev(struct xdr_stream *xdr, uint32_t *bitmap, dev_t *rde
4066 3967
4067 p = xdr_inline_decode(xdr, 8); 3968 p = xdr_inline_decode(xdr, 8);
4068 if (unlikely(!p)) 3969 if (unlikely(!p))
4069 goto out_overflow; 3970 return -EIO;
4070 major = be32_to_cpup(p++); 3971 major = be32_to_cpup(p++);
4071 minor = be32_to_cpup(p); 3972 minor = be32_to_cpup(p);
4072 tmp = MKDEV(major, minor); 3973 tmp = MKDEV(major, minor);
@@ -4077,9 +3978,6 @@ static int decode_attr_rdev(struct xdr_stream *xdr, uint32_t *bitmap, dev_t *rde
4077 } 3978 }
4078 dprintk("%s: rdev=(0x%x:0x%x)\n", __func__, major, minor); 3979 dprintk("%s: rdev=(0x%x:0x%x)\n", __func__, major, minor);
4079 return ret; 3980 return ret;
4080out_overflow:
4081 print_overflow_msg(__func__, xdr);
4082 return -EIO;
4083} 3981}
4084 3982
4085static int decode_attr_space_avail(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) 3983static int decode_attr_space_avail(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res)
@@ -4093,15 +3991,12 @@ static int decode_attr_space_avail(struct xdr_stream *xdr, uint32_t *bitmap, uin
4093 if (likely(bitmap[1] & FATTR4_WORD1_SPACE_AVAIL)) { 3991 if (likely(bitmap[1] & FATTR4_WORD1_SPACE_AVAIL)) {
4094 p = xdr_inline_decode(xdr, 8); 3992 p = xdr_inline_decode(xdr, 8);
4095 if (unlikely(!p)) 3993 if (unlikely(!p))
4096 goto out_overflow; 3994 return -EIO;
4097 xdr_decode_hyper(p, res); 3995 xdr_decode_hyper(p, res);
4098 bitmap[1] &= ~FATTR4_WORD1_SPACE_AVAIL; 3996 bitmap[1] &= ~FATTR4_WORD1_SPACE_AVAIL;
4099 } 3997 }
4100 dprintk("%s: space avail=%Lu\n", __func__, (unsigned long long)*res); 3998 dprintk("%s: space avail=%Lu\n", __func__, (unsigned long long)*res);
4101 return status; 3999 return status;
4102out_overflow:
4103 print_overflow_msg(__func__, xdr);
4104 return -EIO;
4105} 4000}
4106 4001
4107static int decode_attr_space_free(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) 4002static int decode_attr_space_free(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res)
@@ -4115,15 +4010,12 @@ static int decode_attr_space_free(struct xdr_stream *xdr, uint32_t *bitmap, uint
4115 if (likely(bitmap[1] & FATTR4_WORD1_SPACE_FREE)) { 4010 if (likely(bitmap[1] & FATTR4_WORD1_SPACE_FREE)) {
4116 p = xdr_inline_decode(xdr, 8); 4011 p = xdr_inline_decode(xdr, 8);
4117 if (unlikely(!p)) 4012 if (unlikely(!p))
4118 goto out_overflow; 4013 return -EIO;
4119 xdr_decode_hyper(p, res); 4014 xdr_decode_hyper(p, res);
4120 bitmap[1] &= ~FATTR4_WORD1_SPACE_FREE; 4015 bitmap[1] &= ~FATTR4_WORD1_SPACE_FREE;
4121 } 4016 }
4122 dprintk("%s: space free=%Lu\n", __func__, (unsigned long long)*res); 4017 dprintk("%s: space free=%Lu\n", __func__, (unsigned long long)*res);
4123 return status; 4018 return status;
4124out_overflow:
4125 print_overflow_msg(__func__, xdr);
4126 return -EIO;
4127} 4019}
4128 4020
4129static int decode_attr_space_total(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res) 4021static int decode_attr_space_total(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *res)
@@ -4137,15 +4029,12 @@ static int decode_attr_space_total(struct xdr_stream *xdr, uint32_t *bitmap, uin
4137 if (likely(bitmap[1] & FATTR4_WORD1_SPACE_TOTAL)) { 4029 if (likely(bitmap[1] & FATTR4_WORD1_SPACE_TOTAL)) {
4138 p = xdr_inline_decode(xdr, 8); 4030 p = xdr_inline_decode(xdr, 8);
4139 if (unlikely(!p)) 4031 if (unlikely(!p))
4140 goto out_overflow; 4032 return -EIO;
4141 xdr_decode_hyper(p, res); 4033 xdr_decode_hyper(p, res);
4142 bitmap[1] &= ~FATTR4_WORD1_SPACE_TOTAL; 4034 bitmap[1] &= ~FATTR4_WORD1_SPACE_TOTAL;
4143 } 4035 }
4144 dprintk("%s: space total=%Lu\n", __func__, (unsigned long long)*res); 4036 dprintk("%s: space total=%Lu\n", __func__, (unsigned long long)*res);
4145 return status; 4037 return status;
4146out_overflow:
4147 print_overflow_msg(__func__, xdr);
4148 return -EIO;
4149} 4038}
4150 4039
4151static int decode_attr_space_used(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *used) 4040static int decode_attr_space_used(struct xdr_stream *xdr, uint32_t *bitmap, uint64_t *used)
@@ -4159,7 +4048,7 @@ static int decode_attr_space_used(struct xdr_stream *xdr, uint32_t *bitmap, uint
4159 if (likely(bitmap[1] & FATTR4_WORD1_SPACE_USED)) { 4048 if (likely(bitmap[1] & FATTR4_WORD1_SPACE_USED)) {
4160 p = xdr_inline_decode(xdr, 8); 4049 p = xdr_inline_decode(xdr, 8);
4161 if (unlikely(!p)) 4050 if (unlikely(!p))
4162 goto out_overflow; 4051 return -EIO;
4163 xdr_decode_hyper(p, used); 4052 xdr_decode_hyper(p, used);
4164 bitmap[1] &= ~FATTR4_WORD1_SPACE_USED; 4053 bitmap[1] &= ~FATTR4_WORD1_SPACE_USED;
4165 ret = NFS_ATTR_FATTR_SPACE_USED; 4054 ret = NFS_ATTR_FATTR_SPACE_USED;
@@ -4167,9 +4056,6 @@ static int decode_attr_space_used(struct xdr_stream *xdr, uint32_t *bitmap, uint
4167 dprintk("%s: space used=%Lu\n", __func__, 4056 dprintk("%s: space used=%Lu\n", __func__,
4168 (unsigned long long)*used); 4057 (unsigned long long)*used);
4169 return ret; 4058 return ret;
4170out_overflow:
4171 print_overflow_msg(__func__, xdr);
4172 return -EIO;
4173} 4059}
4174 4060
4175static __be32 * 4061static __be32 *
@@ -4189,12 +4075,9 @@ static int decode_attr_time(struct xdr_stream *xdr, struct timespec *time)
4189 4075
4190 p = xdr_inline_decode(xdr, nfstime4_maxsz << 2); 4076 p = xdr_inline_decode(xdr, nfstime4_maxsz << 2);
4191 if (unlikely(!p)) 4077 if (unlikely(!p))
4192 goto out_overflow; 4078 return -EIO;
4193 xdr_decode_nfstime4(p, time); 4079 xdr_decode_nfstime4(p, time);
4194 return 0; 4080 return 0;
4195out_overflow:
4196 print_overflow_msg(__func__, xdr);
4197 return -EIO;
4198} 4081}
4199 4082
4200static int decode_attr_time_access(struct xdr_stream *xdr, uint32_t *bitmap, struct timespec *time) 4083static int decode_attr_time_access(struct xdr_stream *xdr, uint32_t *bitmap, struct timespec *time)
@@ -4265,19 +4148,19 @@ static int decode_attr_security_label(struct xdr_stream *xdr, uint32_t *bitmap,
4265 if (likely(bitmap[2] & FATTR4_WORD2_SECURITY_LABEL)) { 4148 if (likely(bitmap[2] & FATTR4_WORD2_SECURITY_LABEL)) {
4266 p = xdr_inline_decode(xdr, 4); 4149 p = xdr_inline_decode(xdr, 4);
4267 if (unlikely(!p)) 4150 if (unlikely(!p))
4268 goto out_overflow; 4151 return -EIO;
4269 lfs = be32_to_cpup(p++); 4152 lfs = be32_to_cpup(p++);
4270 p = xdr_inline_decode(xdr, 4); 4153 p = xdr_inline_decode(xdr, 4);
4271 if (unlikely(!p)) 4154 if (unlikely(!p))
4272 goto out_overflow; 4155 return -EIO;
4273 pi = be32_to_cpup(p++); 4156 pi = be32_to_cpup(p++);
4274 p = xdr_inline_decode(xdr, 4); 4157 p = xdr_inline_decode(xdr, 4);
4275 if (unlikely(!p)) 4158 if (unlikely(!p))
4276 goto out_overflow; 4159 return -EIO;
4277 len = be32_to_cpup(p++); 4160 len = be32_to_cpup(p++);
4278 p = xdr_inline_decode(xdr, len); 4161 p = xdr_inline_decode(xdr, len);
4279 if (unlikely(!p)) 4162 if (unlikely(!p))
4280 goto out_overflow; 4163 return -EIO;
4281 if (len < NFS4_MAXLABELLEN) { 4164 if (len < NFS4_MAXLABELLEN) {
4282 if (label) { 4165 if (label) {
4283 memcpy(label->label, p, len); 4166 memcpy(label->label, p, len);
@@ -4295,10 +4178,6 @@ static int decode_attr_security_label(struct xdr_stream *xdr, uint32_t *bitmap,
4295 dprintk("%s: label=%s, len=%d, PI=%d, LFS=%d\n", __func__, 4178 dprintk("%s: label=%s, len=%d, PI=%d, LFS=%d\n", __func__,
4296 (char *)label->label, label->len, label->pi, label->lfs); 4179 (char *)label->label, label->len, label->pi, label->lfs);
4297 return status; 4180 return status;
4298
4299out_overflow:
4300 print_overflow_msg(__func__, xdr);
4301 return -EIO;
4302} 4181}
4303 4182
4304static int decode_attr_time_modify(struct xdr_stream *xdr, uint32_t *bitmap, struct timespec *time) 4183static int decode_attr_time_modify(struct xdr_stream *xdr, uint32_t *bitmap, struct timespec *time)
@@ -4342,14 +4221,11 @@ static int decode_change_info(struct xdr_stream *xdr, struct nfs4_change_info *c
4342 4221
4343 p = xdr_inline_decode(xdr, 20); 4222 p = xdr_inline_decode(xdr, 20);
4344 if (unlikely(!p)) 4223 if (unlikely(!p))
4345 goto out_overflow; 4224 return -EIO;
4346 cinfo->atomic = be32_to_cpup(p++); 4225 cinfo->atomic = be32_to_cpup(p++);
4347 p = xdr_decode_hyper(p, &cinfo->before); 4226 p = xdr_decode_hyper(p, &cinfo->before);
4348 xdr_decode_hyper(p, &cinfo->after); 4227 xdr_decode_hyper(p, &cinfo->after);
4349 return 0; 4228 return 0;
4350out_overflow:
4351 print_overflow_msg(__func__, xdr);
4352 return -EIO;
4353} 4229}
4354 4230
4355static int decode_access(struct xdr_stream *xdr, u32 *supported, u32 *access) 4231static int decode_access(struct xdr_stream *xdr, u32 *supported, u32 *access)
@@ -4363,24 +4239,19 @@ static int decode_access(struct xdr_stream *xdr, u32 *supported, u32 *access)
4363 return status; 4239 return status;
4364 p = xdr_inline_decode(xdr, 8); 4240 p = xdr_inline_decode(xdr, 8);
4365 if (unlikely(!p)) 4241 if (unlikely(!p))
4366 goto out_overflow; 4242 return -EIO;
4367 supp = be32_to_cpup(p++); 4243 supp = be32_to_cpup(p++);
4368 acc = be32_to_cpup(p); 4244 acc = be32_to_cpup(p);
4369 *supported = supp; 4245 *supported = supp;
4370 *access = acc; 4246 *access = acc;
4371 return 0; 4247 return 0;
4372out_overflow:
4373 print_overflow_msg(__func__, xdr);
4374 return -EIO;
4375} 4248}
4376 4249
4377static int decode_opaque_fixed(struct xdr_stream *xdr, void *buf, size_t len) 4250static int decode_opaque_fixed(struct xdr_stream *xdr, void *buf, size_t len)
4378{ 4251{
4379 ssize_t ret = xdr_stream_decode_opaque_fixed(xdr, buf, len); 4252 ssize_t ret = xdr_stream_decode_opaque_fixed(xdr, buf, len);
4380 if (unlikely(ret < 0)) { 4253 if (unlikely(ret < 0))
4381 print_overflow_msg(__func__, xdr);
4382 return -EIO; 4254 return -EIO;
4383 }
4384 return 0; 4255 return 0;
4385} 4256}
4386 4257
@@ -4460,13 +4331,11 @@ static int decode_create(struct xdr_stream *xdr, struct nfs4_change_info *cinfo)
4460 return status; 4331 return status;
4461 p = xdr_inline_decode(xdr, 4); 4332 p = xdr_inline_decode(xdr, 4);
4462 if (unlikely(!p)) 4333 if (unlikely(!p))
4463 goto out_overflow; 4334 return -EIO;
4464 bmlen = be32_to_cpup(p); 4335 bmlen = be32_to_cpup(p);
4465 p = xdr_inline_decode(xdr, bmlen << 2); 4336 p = xdr_inline_decode(xdr, bmlen << 2);
4466 if (likely(p)) 4337 if (likely(p))
4467 return 0; 4338 return 0;
4468out_overflow:
4469 print_overflow_msg(__func__, xdr);
4470 return -EIO; 4339 return -EIO;
4471} 4340}
4472 4341
@@ -4574,13 +4443,10 @@ static int decode_threshold_hint(struct xdr_stream *xdr,
4574 if (likely(bitmap[0] & hint_bit)) { 4443 if (likely(bitmap[0] & hint_bit)) {
4575 p = xdr_inline_decode(xdr, 8); 4444 p = xdr_inline_decode(xdr, 8);
4576 if (unlikely(!p)) 4445 if (unlikely(!p))
4577 goto out_overflow; 4446 return -EIO;
4578 xdr_decode_hyper(p, res); 4447 xdr_decode_hyper(p, res);
4579 } 4448 }
4580 return 0; 4449 return 0;
4581out_overflow:
4582 print_overflow_msg(__func__, xdr);
4583 return -EIO;
4584} 4450}
4585 4451
4586static int decode_first_threshold_item4(struct xdr_stream *xdr, 4452static int decode_first_threshold_item4(struct xdr_stream *xdr,
@@ -4593,10 +4459,8 @@ static int decode_first_threshold_item4(struct xdr_stream *xdr,
4593 4459
4594 /* layout type */ 4460 /* layout type */
4595 p = xdr_inline_decode(xdr, 4); 4461 p = xdr_inline_decode(xdr, 4);
4596 if (unlikely(!p)) { 4462 if (unlikely(!p))
4597 print_overflow_msg(__func__, xdr);
4598 return -EIO; 4463 return -EIO;
4599 }
4600 res->l_type = be32_to_cpup(p); 4464 res->l_type = be32_to_cpup(p);
4601 4465
4602 /* thi_hintset bitmap */ 4466 /* thi_hintset bitmap */
@@ -4654,7 +4518,7 @@ static int decode_attr_mdsthreshold(struct xdr_stream *xdr,
4654 return -EREMOTEIO; 4518 return -EREMOTEIO;
4655 p = xdr_inline_decode(xdr, 4); 4519 p = xdr_inline_decode(xdr, 4);
4656 if (unlikely(!p)) 4520 if (unlikely(!p))
4657 goto out_overflow; 4521 return -EIO;
4658 num = be32_to_cpup(p); 4522 num = be32_to_cpup(p);
4659 if (num == 0) 4523 if (num == 0)
4660 return 0; 4524 return 0;
@@ -4667,9 +4531,6 @@ static int decode_attr_mdsthreshold(struct xdr_stream *xdr,
4667 bitmap[2] &= ~FATTR4_WORD2_MDSTHRESHOLD; 4531 bitmap[2] &= ~FATTR4_WORD2_MDSTHRESHOLD;
4668 } 4532 }
4669 return status; 4533 return status;
4670out_overflow:
4671 print_overflow_msg(__func__, xdr);
4672 return -EIO;
4673} 4534}
4674 4535
4675static int decode_getfattr_attrs(struct xdr_stream *xdr, uint32_t *bitmap, 4536static int decode_getfattr_attrs(struct xdr_stream *xdr, uint32_t *bitmap,
@@ -4857,7 +4718,7 @@ static int decode_pnfs_layout_types(struct xdr_stream *xdr,
4857 4718
4858 p = xdr_inline_decode(xdr, 4); 4719 p = xdr_inline_decode(xdr, 4);
4859 if (unlikely(!p)) 4720 if (unlikely(!p))
4860 goto out_overflow; 4721 return -EIO;
4861 fsinfo->nlayouttypes = be32_to_cpup(p); 4722 fsinfo->nlayouttypes = be32_to_cpup(p);
4862 4723
4863 /* pNFS is not supported by the underlying file system */ 4724 /* pNFS is not supported by the underlying file system */
@@ -4867,7 +4728,7 @@ static int decode_pnfs_layout_types(struct xdr_stream *xdr,
4867 /* Decode and set first layout type, move xdr->p past unused types */ 4728 /* Decode and set first layout type, move xdr->p past unused types */
4868 p = xdr_inline_decode(xdr, fsinfo->nlayouttypes * 4); 4729 p = xdr_inline_decode(xdr, fsinfo->nlayouttypes * 4);
4869 if (unlikely(!p)) 4730 if (unlikely(!p))
4870 goto out_overflow; 4731 return -EIO;
4871 4732
4872 /* If we get too many, then just cap it at the max */ 4733 /* If we get too many, then just cap it at the max */
4873 if (fsinfo->nlayouttypes > NFS_MAX_LAYOUT_TYPES) { 4734 if (fsinfo->nlayouttypes > NFS_MAX_LAYOUT_TYPES) {
@@ -4879,9 +4740,6 @@ static int decode_pnfs_layout_types(struct xdr_stream *xdr,
4879 for(i = 0; i < fsinfo->nlayouttypes; ++i) 4740 for(i = 0; i < fsinfo->nlayouttypes; ++i)
4880 fsinfo->layouttype[i] = be32_to_cpup(p++); 4741 fsinfo->layouttype[i] = be32_to_cpup(p++);
4881 return 0; 4742 return 0;
4882out_overflow:
4883 print_overflow_msg(__func__, xdr);
4884 return -EIO;
4885} 4743}
4886 4744
4887/* 4745/*
@@ -4915,10 +4773,8 @@ static int decode_attr_layout_blksize(struct xdr_stream *xdr, uint32_t *bitmap,
4915 *res = 0; 4773 *res = 0;
4916 if (bitmap[2] & FATTR4_WORD2_LAYOUT_BLKSIZE) { 4774 if (bitmap[2] & FATTR4_WORD2_LAYOUT_BLKSIZE) {
4917 p = xdr_inline_decode(xdr, 4); 4775 p = xdr_inline_decode(xdr, 4);
4918 if (unlikely(!p)) { 4776 if (unlikely(!p))
4919 print_overflow_msg(__func__, xdr);
4920 return -EIO; 4777 return -EIO;
4921 }
4922 *res = be32_to_cpup(p); 4778 *res = be32_to_cpup(p);
4923 bitmap[2] &= ~FATTR4_WORD2_LAYOUT_BLKSIZE; 4779 bitmap[2] &= ~FATTR4_WORD2_LAYOUT_BLKSIZE;
4924 } 4780 }
@@ -4937,10 +4793,8 @@ static int decode_attr_clone_blksize(struct xdr_stream *xdr, uint32_t *bitmap,
4937 *res = 0; 4793 *res = 0;
4938 if (bitmap[2] & FATTR4_WORD2_CLONE_BLKSIZE) { 4794 if (bitmap[2] & FATTR4_WORD2_CLONE_BLKSIZE) {
4939 p = xdr_inline_decode(xdr, 4); 4795 p = xdr_inline_decode(xdr, 4);
4940 if (unlikely(!p)) { 4796 if (unlikely(!p))
4941 print_overflow_msg(__func__, xdr);
4942 return -EIO; 4797 return -EIO;
4943 }
4944 *res = be32_to_cpup(p); 4798 *res = be32_to_cpup(p);
4945 bitmap[2] &= ~FATTR4_WORD2_CLONE_BLKSIZE; 4799 bitmap[2] &= ~FATTR4_WORD2_CLONE_BLKSIZE;
4946 } 4800 }
@@ -5016,19 +4870,16 @@ static int decode_getfh(struct xdr_stream *xdr, struct nfs_fh *fh)
5016 4870
5017 p = xdr_inline_decode(xdr, 4); 4871 p = xdr_inline_decode(xdr, 4);
5018 if (unlikely(!p)) 4872 if (unlikely(!p))
5019 goto out_overflow; 4873 return -EIO;
5020 len = be32_to_cpup(p); 4874 len = be32_to_cpup(p);
5021 if (len > NFS4_FHSIZE) 4875 if (len > NFS4_FHSIZE)
5022 return -EIO; 4876 return -EIO;
5023 fh->size = len; 4877 fh->size = len;
5024 p = xdr_inline_decode(xdr, len); 4878 p = xdr_inline_decode(xdr, len);
5025 if (unlikely(!p)) 4879 if (unlikely(!p))
5026 goto out_overflow; 4880 return -EIO;
5027 memcpy(fh->data, p, len); 4881 memcpy(fh->data, p, len);
5028 return 0; 4882 return 0;
5029out_overflow:
5030 print_overflow_msg(__func__, xdr);
5031 return -EIO;
5032} 4883}
5033 4884
5034static int decode_link(struct xdr_stream *xdr, struct nfs4_change_info *cinfo) 4885static int decode_link(struct xdr_stream *xdr, struct nfs4_change_info *cinfo)
@@ -5052,7 +4903,7 @@ static int decode_lock_denied (struct xdr_stream *xdr, struct file_lock *fl)
5052 4903
5053 p = xdr_inline_decode(xdr, 32); /* read 32 bytes */ 4904 p = xdr_inline_decode(xdr, 32); /* read 32 bytes */
5054 if (unlikely(!p)) 4905 if (unlikely(!p))
5055 goto out_overflow; 4906 return -EIO;
5056 p = xdr_decode_hyper(p, &offset); /* read 2 8-byte long words */ 4907 p = xdr_decode_hyper(p, &offset); /* read 2 8-byte long words */
5057 p = xdr_decode_hyper(p, &length); 4908 p = xdr_decode_hyper(p, &length);
5058 type = be32_to_cpup(p++); /* 4 byte read */ 4909 type = be32_to_cpup(p++); /* 4 byte read */
@@ -5069,11 +4920,9 @@ static int decode_lock_denied (struct xdr_stream *xdr, struct file_lock *fl)
5069 p = xdr_decode_hyper(p, &clientid); /* read 8 bytes */ 4920 p = xdr_decode_hyper(p, &clientid); /* read 8 bytes */
5070 namelen = be32_to_cpup(p); /* read 4 bytes */ /* have read all 32 bytes now */ 4921 namelen = be32_to_cpup(p); /* read 4 bytes */ /* have read all 32 bytes now */
5071 p = xdr_inline_decode(xdr, namelen); /* variable size field */ 4922 p = xdr_inline_decode(xdr, namelen); /* variable size field */
5072 if (likely(p)) 4923 if (likely(!p))
5073 return -NFS4ERR_DENIED; 4924 return -EIO;
5074out_overflow: 4925 return -NFS4ERR_DENIED;
5075 print_overflow_msg(__func__, xdr);
5076 return -EIO;
5077} 4926}
5078 4927
5079static int decode_lock(struct xdr_stream *xdr, struct nfs_lock_res *res) 4928static int decode_lock(struct xdr_stream *xdr, struct nfs_lock_res *res)
@@ -5142,7 +4991,7 @@ static int decode_space_limit(struct xdr_stream *xdr,
5142 4991
5143 p = xdr_inline_decode(xdr, 12); 4992 p = xdr_inline_decode(xdr, 12);
5144 if (unlikely(!p)) 4993 if (unlikely(!p))
5145 goto out_overflow; 4994 return -EIO;
5146 limit_type = be32_to_cpup(p++); 4995 limit_type = be32_to_cpup(p++);
5147 switch (limit_type) { 4996 switch (limit_type) {
5148 case NFS4_LIMIT_SIZE: 4997 case NFS4_LIMIT_SIZE:
@@ -5156,9 +5005,6 @@ static int decode_space_limit(struct xdr_stream *xdr,
5156 maxsize >>= PAGE_SHIFT; 5005 maxsize >>= PAGE_SHIFT;
5157 *pagemod_limit = min_t(u64, maxsize, ULONG_MAX); 5006 *pagemod_limit = min_t(u64, maxsize, ULONG_MAX);
5158 return 0; 5007 return 0;
5159out_overflow:
5160 print_overflow_msg(__func__, xdr);
5161 return -EIO;
5162} 5008}
5163 5009
5164static int decode_rw_delegation(struct xdr_stream *xdr, 5010static int decode_rw_delegation(struct xdr_stream *xdr,
@@ -5173,7 +5019,7 @@ static int decode_rw_delegation(struct xdr_stream *xdr,
5173 return status; 5019 return status;
5174 p = xdr_inline_decode(xdr, 4); 5020 p = xdr_inline_decode(xdr, 4);
5175 if (unlikely(!p)) 5021 if (unlikely(!p))
5176 goto out_overflow; 5022 return -EIO;
5177 res->do_recall = be32_to_cpup(p); 5023 res->do_recall = be32_to_cpup(p);
5178 5024
5179 switch (delegation_type) { 5025 switch (delegation_type) {
@@ -5186,9 +5032,6 @@ static int decode_rw_delegation(struct xdr_stream *xdr,
5186 return -EIO; 5032 return -EIO;
5187 } 5033 }
5188 return decode_ace(xdr, NULL); 5034 return decode_ace(xdr, NULL);
5189out_overflow:
5190 print_overflow_msg(__func__, xdr);
5191 return -EIO;
5192} 5035}
5193 5036
5194static int decode_no_delegation(struct xdr_stream *xdr, struct nfs_openres *res) 5037static int decode_no_delegation(struct xdr_stream *xdr, struct nfs_openres *res)
@@ -5198,7 +5041,7 @@ static int decode_no_delegation(struct xdr_stream *xdr, struct nfs_openres *res)
5198 5041
5199 p = xdr_inline_decode(xdr, 4); 5042 p = xdr_inline_decode(xdr, 4);
5200 if (unlikely(!p)) 5043 if (unlikely(!p))
5201 goto out_overflow; 5044 return -EIO;
5202 why_no_delegation = be32_to_cpup(p); 5045 why_no_delegation = be32_to_cpup(p);
5203 switch (why_no_delegation) { 5046 switch (why_no_delegation) {
5204 case WND4_CONTENTION: 5047 case WND4_CONTENTION:
@@ -5207,9 +5050,6 @@ static int decode_no_delegation(struct xdr_stream *xdr, struct nfs_openres *res)
5207 /* Ignore for now */ 5050 /* Ignore for now */
5208 } 5051 }
5209 return 0; 5052 return 0;
5210out_overflow:
5211 print_overflow_msg(__func__, xdr);
5212 return -EIO;
5213} 5053}
5214 5054
5215static int decode_delegation(struct xdr_stream *xdr, struct nfs_openres *res) 5055static int decode_delegation(struct xdr_stream *xdr, struct nfs_openres *res)
@@ -5219,7 +5059,7 @@ static int decode_delegation(struct xdr_stream *xdr, struct nfs_openres *res)
5219 5059
5220 p = xdr_inline_decode(xdr, 4); 5060 p = xdr_inline_decode(xdr, 4);
5221 if (unlikely(!p)) 5061 if (unlikely(!p))
5222 goto out_overflow; 5062 return -EIO;
5223 delegation_type = be32_to_cpup(p); 5063 delegation_type = be32_to_cpup(p);
5224 res->delegation_type = 0; 5064 res->delegation_type = 0;
5225 switch (delegation_type) { 5065 switch (delegation_type) {
@@ -5232,9 +5072,6 @@ static int decode_delegation(struct xdr_stream *xdr, struct nfs_openres *res)
5232 return decode_no_delegation(xdr, res); 5072 return decode_no_delegation(xdr, res);
5233 } 5073 }
5234 return -EIO; 5074 return -EIO;
5235out_overflow:
5236 print_overflow_msg(__func__, xdr);
5237 return -EIO;
5238} 5075}
5239 5076
5240static int decode_open(struct xdr_stream *xdr, struct nfs_openres *res) 5077static int decode_open(struct xdr_stream *xdr, struct nfs_openres *res)
@@ -5256,7 +5093,7 @@ static int decode_open(struct xdr_stream *xdr, struct nfs_openres *res)
5256 5093
5257 p = xdr_inline_decode(xdr, 8); 5094 p = xdr_inline_decode(xdr, 8);
5258 if (unlikely(!p)) 5095 if (unlikely(!p))
5259 goto out_overflow; 5096 return -EIO;
5260 res->rflags = be32_to_cpup(p++); 5097 res->rflags = be32_to_cpup(p++);
5261 bmlen = be32_to_cpup(p); 5098 bmlen = be32_to_cpup(p);
5262 if (bmlen > 10) 5099 if (bmlen > 10)
@@ -5264,7 +5101,7 @@ static int decode_open(struct xdr_stream *xdr, struct nfs_openres *res)
5264 5101
5265 p = xdr_inline_decode(xdr, bmlen << 2); 5102 p = xdr_inline_decode(xdr, bmlen << 2);
5266 if (unlikely(!p)) 5103 if (unlikely(!p))
5267 goto out_overflow; 5104 return -EIO;
5268 savewords = min_t(uint32_t, bmlen, NFS4_BITMAP_SIZE); 5105 savewords = min_t(uint32_t, bmlen, NFS4_BITMAP_SIZE);
5269 for (i = 0; i < savewords; ++i) 5106 for (i = 0; i < savewords; ++i)
5270 res->attrset[i] = be32_to_cpup(p++); 5107 res->attrset[i] = be32_to_cpup(p++);
@@ -5275,9 +5112,6 @@ static int decode_open(struct xdr_stream *xdr, struct nfs_openres *res)
5275xdr_error: 5112xdr_error:
5276 dprintk("%s: Bitmap too large! Length = %u\n", __func__, bmlen); 5113 dprintk("%s: Bitmap too large! Length = %u\n", __func__, bmlen);
5277 return -EIO; 5114 return -EIO;
5278out_overflow:
5279 print_overflow_msg(__func__, xdr);
5280 return -EIO;
5281} 5115}
5282 5116
5283static int decode_open_confirm(struct xdr_stream *xdr, struct nfs_open_confirmres *res) 5117static int decode_open_confirm(struct xdr_stream *xdr, struct nfs_open_confirmres *res)
@@ -5326,7 +5160,7 @@ static int decode_read(struct xdr_stream *xdr, struct rpc_rqst *req,
5326 return status; 5160 return status;
5327 p = xdr_inline_decode(xdr, 8); 5161 p = xdr_inline_decode(xdr, 8);
5328 if (unlikely(!p)) 5162 if (unlikely(!p))
5329 goto out_overflow; 5163 return -EIO;
5330 eof = be32_to_cpup(p++); 5164 eof = be32_to_cpup(p++);
5331 count = be32_to_cpup(p); 5165 count = be32_to_cpup(p);
5332 recvd = xdr_read_pages(xdr, count); 5166 recvd = xdr_read_pages(xdr, count);
@@ -5339,9 +5173,6 @@ static int decode_read(struct xdr_stream *xdr, struct rpc_rqst *req,
5339 res->eof = eof; 5173 res->eof = eof;
5340 res->count = count; 5174 res->count = count;
5341 return 0; 5175 return 0;
5342out_overflow:
5343 print_overflow_msg(__func__, xdr);
5344 return -EIO;
5345} 5176}
5346 5177
5347static int decode_readdir(struct xdr_stream *xdr, struct rpc_rqst *req, struct nfs4_readdir_res *readdir) 5178static int decode_readdir(struct xdr_stream *xdr, struct rpc_rqst *req, struct nfs4_readdir_res *readdir)
@@ -5374,7 +5205,7 @@ static int decode_readlink(struct xdr_stream *xdr, struct rpc_rqst *req)
5374 /* Convert length of symlink */ 5205 /* Convert length of symlink */
5375 p = xdr_inline_decode(xdr, 4); 5206 p = xdr_inline_decode(xdr, 4);
5376 if (unlikely(!p)) 5207 if (unlikely(!p))
5377 goto out_overflow; 5208 return -EIO;
5378 len = be32_to_cpup(p); 5209 len = be32_to_cpup(p);
5379 if (len >= rcvbuf->page_len || len <= 0) { 5210 if (len >= rcvbuf->page_len || len <= 0) {
5380 dprintk("nfs: server returned giant symlink!\n"); 5211 dprintk("nfs: server returned giant symlink!\n");
@@ -5395,9 +5226,6 @@ static int decode_readlink(struct xdr_stream *xdr, struct rpc_rqst *req)
5395 */ 5226 */
5396 xdr_terminate_string(rcvbuf, len); 5227 xdr_terminate_string(rcvbuf, len);
5397 return 0; 5228 return 0;
5398out_overflow:
5399 print_overflow_msg(__func__, xdr);
5400 return -EIO;
5401} 5229}
5402 5230
5403static int decode_remove(struct xdr_stream *xdr, struct nfs4_change_info *cinfo) 5231static int decode_remove(struct xdr_stream *xdr, struct nfs4_change_info *cinfo)
@@ -5500,7 +5328,6 @@ static int decode_setattr(struct xdr_stream *xdr)
5500 return status; 5328 return status;
5501 if (decode_bitmap4(xdr, NULL, 0) >= 0) 5329 if (decode_bitmap4(xdr, NULL, 0) >= 0)
5502 return 0; 5330 return 0;
5503 print_overflow_msg(__func__, xdr);
5504 return -EIO; 5331 return -EIO;
5505} 5332}
5506 5333
@@ -5512,7 +5339,7 @@ static int decode_setclientid(struct xdr_stream *xdr, struct nfs4_setclientid_re
5512 5339
5513 p = xdr_inline_decode(xdr, 8); 5340 p = xdr_inline_decode(xdr, 8);
5514 if (unlikely(!p)) 5341 if (unlikely(!p))
5515 goto out_overflow; 5342 return -EIO;
5516 opnum = be32_to_cpup(p++); 5343 opnum = be32_to_cpup(p++);
5517 if (opnum != OP_SETCLIENTID) { 5344 if (opnum != OP_SETCLIENTID) {
5518 dprintk("nfs: decode_setclientid: Server returned operation" 5345 dprintk("nfs: decode_setclientid: Server returned operation"
@@ -5523,7 +5350,7 @@ static int decode_setclientid(struct xdr_stream *xdr, struct nfs4_setclientid_re
5523 if (nfserr == NFS_OK) { 5350 if (nfserr == NFS_OK) {
5524 p = xdr_inline_decode(xdr, 8 + NFS4_VERIFIER_SIZE); 5351 p = xdr_inline_decode(xdr, 8 + NFS4_VERIFIER_SIZE);
5525 if (unlikely(!p)) 5352 if (unlikely(!p))
5526 goto out_overflow; 5353 return -EIO;
5527 p = xdr_decode_hyper(p, &res->clientid); 5354 p = xdr_decode_hyper(p, &res->clientid);
5528 memcpy(res->confirm.data, p, NFS4_VERIFIER_SIZE); 5355 memcpy(res->confirm.data, p, NFS4_VERIFIER_SIZE);
5529 } else if (nfserr == NFSERR_CLID_INUSE) { 5356 } else if (nfserr == NFSERR_CLID_INUSE) {
@@ -5532,28 +5359,25 @@ static int decode_setclientid(struct xdr_stream *xdr, struct nfs4_setclientid_re
5532 /* skip netid string */ 5359 /* skip netid string */
5533 p = xdr_inline_decode(xdr, 4); 5360 p = xdr_inline_decode(xdr, 4);
5534 if (unlikely(!p)) 5361 if (unlikely(!p))
5535 goto out_overflow; 5362 return -EIO;
5536 len = be32_to_cpup(p); 5363 len = be32_to_cpup(p);
5537 p = xdr_inline_decode(xdr, len); 5364 p = xdr_inline_decode(xdr, len);
5538 if (unlikely(!p)) 5365 if (unlikely(!p))
5539 goto out_overflow; 5366 return -EIO;
5540 5367
5541 /* skip uaddr string */ 5368 /* skip uaddr string */
5542 p = xdr_inline_decode(xdr, 4); 5369 p = xdr_inline_decode(xdr, 4);
5543 if (unlikely(!p)) 5370 if (unlikely(!p))
5544 goto out_overflow; 5371 return -EIO;
5545 len = be32_to_cpup(p); 5372 len = be32_to_cpup(p);
5546 p = xdr_inline_decode(xdr, len); 5373 p = xdr_inline_decode(xdr, len);
5547 if (unlikely(!p)) 5374 if (unlikely(!p))
5548 goto out_overflow; 5375 return -EIO;
5549 return -NFSERR_CLID_INUSE; 5376 return -NFSERR_CLID_INUSE;
5550 } else 5377 } else
5551 return nfs4_stat_to_errno(nfserr); 5378 return nfs4_stat_to_errno(nfserr);
5552 5379
5553 return 0; 5380 return 0;
5554out_overflow:
5555 print_overflow_msg(__func__, xdr);
5556 return -EIO;
5557} 5381}
5558 5382
5559static int decode_setclientid_confirm(struct xdr_stream *xdr) 5383static int decode_setclientid_confirm(struct xdr_stream *xdr)
@@ -5572,13 +5396,10 @@ static int decode_write(struct xdr_stream *xdr, struct nfs_pgio_res *res)
5572 5396
5573 p = xdr_inline_decode(xdr, 8); 5397 p = xdr_inline_decode(xdr, 8);
5574 if (unlikely(!p)) 5398 if (unlikely(!p))
5575 goto out_overflow; 5399 return -EIO;
5576 res->count = be32_to_cpup(p++); 5400 res->count = be32_to_cpup(p++);
5577 res->verf->committed = be32_to_cpup(p++); 5401 res->verf->committed = be32_to_cpup(p++);
5578 return decode_write_verifier(xdr, &res->verf->verifier); 5402 return decode_write_verifier(xdr, &res->verf->verifier);
5579out_overflow:
5580 print_overflow_msg(__func__, xdr);
5581 return -EIO;
5582} 5403}
5583 5404
5584static int decode_delegreturn(struct xdr_stream *xdr) 5405static int decode_delegreturn(struct xdr_stream *xdr)
@@ -5594,30 +5415,24 @@ static int decode_secinfo_gss(struct xdr_stream *xdr,
5594 5415
5595 p = xdr_inline_decode(xdr, 4); 5416 p = xdr_inline_decode(xdr, 4);
5596 if (unlikely(!p)) 5417 if (unlikely(!p))
5597 goto out_overflow; 5418 return -EIO;
5598 oid_len = be32_to_cpup(p); 5419 oid_len = be32_to_cpup(p);
5599 if (oid_len > GSS_OID_MAX_LEN) 5420 if (oid_len > GSS_OID_MAX_LEN)
5600 goto out_err; 5421 return -EINVAL;
5601 5422
5602 p = xdr_inline_decode(xdr, oid_len); 5423 p = xdr_inline_decode(xdr, oid_len);
5603 if (unlikely(!p)) 5424 if (unlikely(!p))
5604 goto out_overflow; 5425 return -EIO;
5605 memcpy(flavor->flavor_info.oid.data, p, oid_len); 5426 memcpy(flavor->flavor_info.oid.data, p, oid_len);
5606 flavor->flavor_info.oid.len = oid_len; 5427 flavor->flavor_info.oid.len = oid_len;
5607 5428
5608 p = xdr_inline_decode(xdr, 8); 5429 p = xdr_inline_decode(xdr, 8);
5609 if (unlikely(!p)) 5430 if (unlikely(!p))
5610 goto out_overflow; 5431 return -EIO;
5611 flavor->flavor_info.qop = be32_to_cpup(p++); 5432 flavor->flavor_info.qop = be32_to_cpup(p++);
5612 flavor->flavor_info.service = be32_to_cpup(p); 5433 flavor->flavor_info.service = be32_to_cpup(p);
5613 5434
5614 return 0; 5435 return 0;
5615
5616out_overflow:
5617 print_overflow_msg(__func__, xdr);
5618 return -EIO;
5619out_err:
5620 return -EINVAL;
5621} 5436}
5622 5437
5623static int decode_secinfo_common(struct xdr_stream *xdr, struct nfs4_secinfo_res *res) 5438static int decode_secinfo_common(struct xdr_stream *xdr, struct nfs4_secinfo_res *res)
@@ -5629,7 +5444,7 @@ static int decode_secinfo_common(struct xdr_stream *xdr, struct nfs4_secinfo_res
5629 5444
5630 p = xdr_inline_decode(xdr, 4); 5445 p = xdr_inline_decode(xdr, 4);
5631 if (unlikely(!p)) 5446 if (unlikely(!p))
5632 goto out_overflow; 5447 return -EIO;
5633 5448
5634 res->flavors->num_flavors = 0; 5449 res->flavors->num_flavors = 0;
5635 num_flavors = be32_to_cpup(p); 5450 num_flavors = be32_to_cpup(p);
@@ -5641,7 +5456,7 @@ static int decode_secinfo_common(struct xdr_stream *xdr, struct nfs4_secinfo_res
5641 5456
5642 p = xdr_inline_decode(xdr, 4); 5457 p = xdr_inline_decode(xdr, 4);
5643 if (unlikely(!p)) 5458 if (unlikely(!p))
5644 goto out_overflow; 5459 return -EIO;
5645 sec_flavor->flavor = be32_to_cpup(p); 5460 sec_flavor->flavor = be32_to_cpup(p);
5646 5461
5647 if (sec_flavor->flavor == RPC_AUTH_GSS) { 5462 if (sec_flavor->flavor == RPC_AUTH_GSS) {
@@ -5655,9 +5470,6 @@ static int decode_secinfo_common(struct xdr_stream *xdr, struct nfs4_secinfo_res
5655 status = 0; 5470 status = 0;
5656out: 5471out:
5657 return status; 5472 return status;
5658out_overflow:
5659 print_overflow_msg(__func__, xdr);
5660 return -EIO;
5661} 5473}
5662 5474
5663static int decode_secinfo(struct xdr_stream *xdr, struct nfs4_secinfo_res *res) 5475static int decode_secinfo(struct xdr_stream *xdr, struct nfs4_secinfo_res *res)
@@ -5711,11 +5523,11 @@ static int decode_exchange_id(struct xdr_stream *xdr,
5711 5523
5712 p = xdr_inline_decode(xdr, 8); 5524 p = xdr_inline_decode(xdr, 8);
5713 if (unlikely(!p)) 5525 if (unlikely(!p))
5714 goto out_overflow; 5526 return -EIO;
5715 xdr_decode_hyper(p, &res->clientid); 5527 xdr_decode_hyper(p, &res->clientid);
5716 p = xdr_inline_decode(xdr, 12); 5528 p = xdr_inline_decode(xdr, 12);
5717 if (unlikely(!p)) 5529 if (unlikely(!p))
5718 goto out_overflow; 5530 return -EIO;
5719 res->seqid = be32_to_cpup(p++); 5531 res->seqid = be32_to_cpup(p++);
5720 res->flags = be32_to_cpup(p++); 5532 res->flags = be32_to_cpup(p++);
5721 5533
@@ -5739,7 +5551,7 @@ static int decode_exchange_id(struct xdr_stream *xdr,
5739 /* server_owner4.so_minor_id */ 5551 /* server_owner4.so_minor_id */
5740 p = xdr_inline_decode(xdr, 8); 5552 p = xdr_inline_decode(xdr, 8);
5741 if (unlikely(!p)) 5553 if (unlikely(!p))
5742 goto out_overflow; 5554 return -EIO;
5743 p = xdr_decode_hyper(p, &res->server_owner->minor_id); 5555 p = xdr_decode_hyper(p, &res->server_owner->minor_id);
5744 5556
5745 /* server_owner4.so_major_id */ 5557 /* server_owner4.so_major_id */
@@ -5759,7 +5571,7 @@ static int decode_exchange_id(struct xdr_stream *xdr,
5759 /* Implementation Id */ 5571 /* Implementation Id */
5760 p = xdr_inline_decode(xdr, 4); 5572 p = xdr_inline_decode(xdr, 4);
5761 if (unlikely(!p)) 5573 if (unlikely(!p))
5762 goto out_overflow; 5574 return -EIO;
5763 impl_id_count = be32_to_cpup(p++); 5575 impl_id_count = be32_to_cpup(p++);
5764 5576
5765 if (impl_id_count) { 5577 if (impl_id_count) {
@@ -5778,16 +5590,13 @@ static int decode_exchange_id(struct xdr_stream *xdr,
5778 /* nii_date */ 5590 /* nii_date */
5779 p = xdr_inline_decode(xdr, 12); 5591 p = xdr_inline_decode(xdr, 12);
5780 if (unlikely(!p)) 5592 if (unlikely(!p))
5781 goto out_overflow; 5593 return -EIO;
5782 p = xdr_decode_hyper(p, &res->impl_id->date.seconds); 5594 p = xdr_decode_hyper(p, &res->impl_id->date.seconds);
5783 res->impl_id->date.nseconds = be32_to_cpup(p); 5595 res->impl_id->date.nseconds = be32_to_cpup(p);
5784 5596
5785 /* if there's more than one entry, ignore the rest */ 5597 /* if there's more than one entry, ignore the rest */
5786 } 5598 }
5787 return 0; 5599 return 0;
5788out_overflow:
5789 print_overflow_msg(__func__, xdr);
5790 return -EIO;
5791} 5600}
5792 5601
5793static int decode_chan_attrs(struct xdr_stream *xdr, 5602static int decode_chan_attrs(struct xdr_stream *xdr,
@@ -5798,7 +5607,7 @@ static int decode_chan_attrs(struct xdr_stream *xdr,
5798 5607
5799 p = xdr_inline_decode(xdr, 28); 5608 p = xdr_inline_decode(xdr, 28);
5800 if (unlikely(!p)) 5609 if (unlikely(!p))
5801 goto out_overflow; 5610 return -EIO;
5802 val = be32_to_cpup(p++); /* headerpadsz */ 5611 val = be32_to_cpup(p++); /* headerpadsz */
5803 if (val) 5612 if (val)
5804 return -EINVAL; /* no support for header padding yet */ 5613 return -EINVAL; /* no support for header padding yet */
@@ -5816,12 +5625,9 @@ static int decode_chan_attrs(struct xdr_stream *xdr,
5816 if (nr_attrs == 1) { 5625 if (nr_attrs == 1) {
5817 p = xdr_inline_decode(xdr, 4); /* skip rdma_attrs */ 5626 p = xdr_inline_decode(xdr, 4); /* skip rdma_attrs */
5818 if (unlikely(!p)) 5627 if (unlikely(!p))
5819 goto out_overflow; 5628 return -EIO;
5820 } 5629 }
5821 return 0; 5630 return 0;
5822out_overflow:
5823 print_overflow_msg(__func__, xdr);
5824 return -EIO;
5825} 5631}
5826 5632
5827static int decode_sessionid(struct xdr_stream *xdr, struct nfs4_sessionid *sid) 5633static int decode_sessionid(struct xdr_stream *xdr, struct nfs4_sessionid *sid)
@@ -5844,7 +5650,7 @@ static int decode_bind_conn_to_session(struct xdr_stream *xdr,
5844 /* dir flags, rdma mode bool */ 5650 /* dir flags, rdma mode bool */
5845 p = xdr_inline_decode(xdr, 8); 5651 p = xdr_inline_decode(xdr, 8);
5846 if (unlikely(!p)) 5652 if (unlikely(!p))
5847 goto out_overflow; 5653 return -EIO;
5848 5654
5849 res->dir = be32_to_cpup(p++); 5655 res->dir = be32_to_cpup(p++);
5850 if (res->dir == 0 || res->dir > NFS4_CDFS4_BOTH) 5656 if (res->dir == 0 || res->dir > NFS4_CDFS4_BOTH)
@@ -5855,9 +5661,6 @@ static int decode_bind_conn_to_session(struct xdr_stream *xdr,
5855 res->use_conn_in_rdma_mode = true; 5661 res->use_conn_in_rdma_mode = true;
5856 5662
5857 return 0; 5663 return 0;
5858out_overflow:
5859 print_overflow_msg(__func__, xdr);
5860 return -EIO;
5861} 5664}
5862 5665
5863static int decode_create_session(struct xdr_stream *xdr, 5666static int decode_create_session(struct xdr_stream *xdr,
@@ -5875,7 +5678,7 @@ static int decode_create_session(struct xdr_stream *xdr,
5875 /* seqid, flags */ 5678 /* seqid, flags */
5876 p = xdr_inline_decode(xdr, 8); 5679 p = xdr_inline_decode(xdr, 8);
5877 if (unlikely(!p)) 5680 if (unlikely(!p))
5878 goto out_overflow; 5681 return -EIO;
5879 res->seqid = be32_to_cpup(p++); 5682 res->seqid = be32_to_cpup(p++);
5880 res->flags = be32_to_cpup(p); 5683 res->flags = be32_to_cpup(p);
5881 5684
@@ -5884,9 +5687,6 @@ static int decode_create_session(struct xdr_stream *xdr,
5884 if (!status) 5687 if (!status)
5885 status = decode_chan_attrs(xdr, &res->bc_attrs); 5688 status = decode_chan_attrs(xdr, &res->bc_attrs);
5886 return status; 5689 return status;
5887out_overflow:
5888 print_overflow_msg(__func__, xdr);
5889 return -EIO;
5890} 5690}
5891 5691
5892static int decode_destroy_session(struct xdr_stream *xdr, void *dummy) 5692static int decode_destroy_session(struct xdr_stream *xdr, void *dummy)
@@ -5967,7 +5767,6 @@ out_err:
5967 res->sr_status = status; 5767 res->sr_status = status;
5968 return status; 5768 return status;
5969out_overflow: 5769out_overflow:
5970 print_overflow_msg(__func__, xdr);
5971 status = -EIO; 5770 status = -EIO;
5972 goto out_err; 5771 goto out_err;
5973#else /* CONFIG_NFS_V4_1 */ 5772#else /* CONFIG_NFS_V4_1 */
@@ -5995,7 +5794,7 @@ static int decode_getdeviceinfo(struct xdr_stream *xdr,
5995 if (status == -ETOOSMALL) { 5794 if (status == -ETOOSMALL) {
5996 p = xdr_inline_decode(xdr, 4); 5795 p = xdr_inline_decode(xdr, 4);
5997 if (unlikely(!p)) 5796 if (unlikely(!p))
5998 goto out_overflow; 5797 return -EIO;
5999 pdev->mincount = be32_to_cpup(p); 5798 pdev->mincount = be32_to_cpup(p);
6000 dprintk("%s: Min count too small. mincnt = %u\n", 5799 dprintk("%s: Min count too small. mincnt = %u\n",
6001 __func__, pdev->mincount); 5800 __func__, pdev->mincount);
@@ -6005,7 +5804,7 @@ static int decode_getdeviceinfo(struct xdr_stream *xdr,
6005 5804
6006 p = xdr_inline_decode(xdr, 8); 5805 p = xdr_inline_decode(xdr, 8);
6007 if (unlikely(!p)) 5806 if (unlikely(!p))
6008 goto out_overflow; 5807 return -EIO;
6009 type = be32_to_cpup(p++); 5808 type = be32_to_cpup(p++);
6010 if (type != pdev->layout_type) { 5809 if (type != pdev->layout_type) {
6011 dprintk("%s: layout mismatch req: %u pdev: %u\n", 5810 dprintk("%s: layout mismatch req: %u pdev: %u\n",
@@ -6019,19 +5818,19 @@ static int decode_getdeviceinfo(struct xdr_stream *xdr,
6019 */ 5818 */
6020 pdev->mincount = be32_to_cpup(p); 5819 pdev->mincount = be32_to_cpup(p);
6021 if (xdr_read_pages(xdr, pdev->mincount) != pdev->mincount) 5820 if (xdr_read_pages(xdr, pdev->mincount) != pdev->mincount)
6022 goto out_overflow; 5821 return -EIO;
6023 5822
6024 /* Parse notification bitmap, verifying that it is zero. */ 5823 /* Parse notification bitmap, verifying that it is zero. */
6025 p = xdr_inline_decode(xdr, 4); 5824 p = xdr_inline_decode(xdr, 4);
6026 if (unlikely(!p)) 5825 if (unlikely(!p))
6027 goto out_overflow; 5826 return -EIO;
6028 len = be32_to_cpup(p); 5827 len = be32_to_cpup(p);
6029 if (len) { 5828 if (len) {
6030 uint32_t i; 5829 uint32_t i;
6031 5830
6032 p = xdr_inline_decode(xdr, 4 * len); 5831 p = xdr_inline_decode(xdr, 4 * len);
6033 if (unlikely(!p)) 5832 if (unlikely(!p))
6034 goto out_overflow; 5833 return -EIO;
6035 5834
6036 res->notification = be32_to_cpup(p++); 5835 res->notification = be32_to_cpup(p++);
6037 for (i = 1; i < len; i++) { 5836 for (i = 1; i < len; i++) {
@@ -6043,9 +5842,6 @@ static int decode_getdeviceinfo(struct xdr_stream *xdr,
6043 } 5842 }
6044 } 5843 }
6045 return 0; 5844 return 0;
6046out_overflow:
6047 print_overflow_msg(__func__, xdr);
6048 return -EIO;
6049} 5845}
6050 5846
6051static int decode_layoutget(struct xdr_stream *xdr, struct rpc_rqst *req, 5847static int decode_layoutget(struct xdr_stream *xdr, struct rpc_rqst *req,
@@ -6115,7 +5911,6 @@ out:
6115 res->status = status; 5911 res->status = status;
6116 return status; 5912 return status;
6117out_overflow: 5913out_overflow:
6118 print_overflow_msg(__func__, xdr);
6119 status = -EIO; 5914 status = -EIO;
6120 goto out; 5915 goto out;
6121} 5916}
@@ -6131,16 +5926,13 @@ static int decode_layoutreturn(struct xdr_stream *xdr,
6131 return status; 5926 return status;
6132 p = xdr_inline_decode(xdr, 4); 5927 p = xdr_inline_decode(xdr, 4);
6133 if (unlikely(!p)) 5928 if (unlikely(!p))
6134 goto out_overflow; 5929 return -EIO;
6135 res->lrs_present = be32_to_cpup(p); 5930 res->lrs_present = be32_to_cpup(p);
6136 if (res->lrs_present) 5931 if (res->lrs_present)
6137 status = decode_layout_stateid(xdr, &res->stateid); 5932 status = decode_layout_stateid(xdr, &res->stateid);
6138 else 5933 else
6139 nfs4_stateid_copy(&res->stateid, &invalid_stateid); 5934 nfs4_stateid_copy(&res->stateid, &invalid_stateid);
6140 return status; 5935 return status;
6141out_overflow:
6142 print_overflow_msg(__func__, xdr);
6143 return -EIO;
6144} 5936}
6145 5937
6146static int decode_layoutcommit(struct xdr_stream *xdr, 5938static int decode_layoutcommit(struct xdr_stream *xdr,
@@ -6158,19 +5950,16 @@ static int decode_layoutcommit(struct xdr_stream *xdr,
6158 5950
6159 p = xdr_inline_decode(xdr, 4); 5951 p = xdr_inline_decode(xdr, 4);
6160 if (unlikely(!p)) 5952 if (unlikely(!p))
6161 goto out_overflow; 5953 return -EIO;
6162 sizechanged = be32_to_cpup(p); 5954 sizechanged = be32_to_cpup(p);
6163 5955
6164 if (sizechanged) { 5956 if (sizechanged) {
6165 /* throw away new size */ 5957 /* throw away new size */
6166 p = xdr_inline_decode(xdr, 8); 5958 p = xdr_inline_decode(xdr, 8);
6167 if (unlikely(!p)) 5959 if (unlikely(!p))
6168 goto out_overflow; 5960 return -EIO;
6169 } 5961 }
6170 return 0; 5962 return 0;
6171out_overflow:
6172 print_overflow_msg(__func__, xdr);
6173 return -EIO;
6174} 5963}
6175 5964
6176static int decode_test_stateid(struct xdr_stream *xdr, 5965static int decode_test_stateid(struct xdr_stream *xdr,
@@ -6186,21 +5975,17 @@ static int decode_test_stateid(struct xdr_stream *xdr,
6186 5975
6187 p = xdr_inline_decode(xdr, 4); 5976 p = xdr_inline_decode(xdr, 4);
6188 if (unlikely(!p)) 5977 if (unlikely(!p))
6189 goto out_overflow; 5978 return -EIO;
6190 num_res = be32_to_cpup(p++); 5979 num_res = be32_to_cpup(p++);
6191 if (num_res != 1) 5980 if (num_res != 1)
6192 goto out; 5981 return -EIO;
6193 5982
6194 p = xdr_inline_decode(xdr, 4); 5983 p = xdr_inline_decode(xdr, 4);
6195 if (unlikely(!p)) 5984 if (unlikely(!p))
6196 goto out_overflow; 5985 return -EIO;
6197 res->status = be32_to_cpup(p++); 5986 res->status = be32_to_cpup(p++);
6198 5987
6199 return status; 5988 return status;
6200out_overflow:
6201 print_overflow_msg(__func__, xdr);
6202out:
6203 return -EIO;
6204} 5989}
6205 5990
6206static int decode_free_stateid(struct xdr_stream *xdr, 5991static int decode_free_stateid(struct xdr_stream *xdr,
@@ -7570,11 +7355,11 @@ int nfs4_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,
7570 uint64_t new_cookie; 7355 uint64_t new_cookie;
7571 __be32 *p = xdr_inline_decode(xdr, 4); 7356 __be32 *p = xdr_inline_decode(xdr, 4);
7572 if (unlikely(!p)) 7357 if (unlikely(!p))
7573 goto out_overflow; 7358 return -EAGAIN;
7574 if (*p == xdr_zero) { 7359 if (*p == xdr_zero) {
7575 p = xdr_inline_decode(xdr, 4); 7360 p = xdr_inline_decode(xdr, 4);
7576 if (unlikely(!p)) 7361 if (unlikely(!p))
7577 goto out_overflow; 7362 return -EAGAIN;
7578 if (*p == xdr_zero) 7363 if (*p == xdr_zero)
7579 return -EAGAIN; 7364 return -EAGAIN;
7580 entry->eof = 1; 7365 entry->eof = 1;
@@ -7583,13 +7368,13 @@ int nfs4_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,
7583 7368
7584 p = xdr_inline_decode(xdr, 12); 7369 p = xdr_inline_decode(xdr, 12);
7585 if (unlikely(!p)) 7370 if (unlikely(!p))
7586 goto out_overflow; 7371 return -EAGAIN;
7587 p = xdr_decode_hyper(p, &new_cookie); 7372 p = xdr_decode_hyper(p, &new_cookie);
7588 entry->len = be32_to_cpup(p); 7373 entry->len = be32_to_cpup(p);
7589 7374
7590 p = xdr_inline_decode(xdr, entry->len); 7375 p = xdr_inline_decode(xdr, entry->len);
7591 if (unlikely(!p)) 7376 if (unlikely(!p))
7592 goto out_overflow; 7377 return -EAGAIN;
7593 entry->name = (const char *) p; 7378 entry->name = (const char *) p;
7594 7379
7595 /* 7380 /*
@@ -7601,14 +7386,14 @@ int nfs4_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,
7601 entry->fattr->valid = 0; 7386 entry->fattr->valid = 0;
7602 7387
7603 if (decode_attr_bitmap(xdr, bitmap) < 0) 7388 if (decode_attr_bitmap(xdr, bitmap) < 0)
7604 goto out_overflow; 7389 return -EAGAIN;
7605 7390
7606 if (decode_attr_length(xdr, &len, &savep) < 0) 7391 if (decode_attr_length(xdr, &len, &savep) < 0)
7607 goto out_overflow; 7392 return -EAGAIN;
7608 7393
7609 if (decode_getfattr_attrs(xdr, bitmap, entry->fattr, entry->fh, 7394 if (decode_getfattr_attrs(xdr, bitmap, entry->fattr, entry->fh,
7610 NULL, entry->label, entry->server) < 0) 7395 NULL, entry->label, entry->server) < 0)
7611 goto out_overflow; 7396 return -EAGAIN;
7612 if (entry->fattr->valid & NFS_ATTR_FATTR_MOUNTED_ON_FILEID) 7397 if (entry->fattr->valid & NFS_ATTR_FATTR_MOUNTED_ON_FILEID)
7613 entry->ino = entry->fattr->mounted_on_fileid; 7398 entry->ino = entry->fattr->mounted_on_fileid;
7614 else if (entry->fattr->valid & NFS_ATTR_FATTR_FILEID) 7399 else if (entry->fattr->valid & NFS_ATTR_FATTR_FILEID)
@@ -7622,10 +7407,6 @@ int nfs4_decode_dirent(struct xdr_stream *xdr, struct nfs_entry *entry,
7622 entry->cookie = new_cookie; 7407 entry->cookie = new_cookie;
7623 7408
7624 return 0; 7409 return 0;
7625
7626out_overflow:
7627 print_overflow_msg(__func__, xdr);
7628 return -EAGAIN;
7629} 7410}
7630 7411
7631/* 7412/*