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.c40
1 files changed, 23 insertions, 17 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index 51dd3804866f..db1ed9c46ede 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -116,10 +116,12 @@ static int nfs4_stat_to_errno(int);
116#define decode_renew_maxsz (op_decode_hdr_maxsz) 116#define decode_renew_maxsz (op_decode_hdr_maxsz)
117#define encode_setclientid_maxsz \ 117#define encode_setclientid_maxsz \
118 (op_encode_hdr_maxsz + \ 118 (op_encode_hdr_maxsz + \
119 4 /*server->ip_addr*/ + \ 119 XDR_QUADLEN(NFS4_VERIFIER_SIZE) + \
120 1 /*Netid*/ + \ 120 XDR_QUADLEN(NFS4_SETCLIENTID_NAMELEN) + \
121 6 /*uaddr*/ + \ 121 1 /* sc_prog */ + \
122 6 + (NFS4_VERIFIER_SIZE >> 2)) 122 XDR_QUADLEN(RPCBIND_MAXNETIDLEN) + \
123 XDR_QUADLEN(RPCBIND_MAXUADDRLEN) + \
124 1) /* sc_cb_ident */
123#define decode_setclientid_maxsz \ 125#define decode_setclientid_maxsz \
124 (op_decode_hdr_maxsz + \ 126 (op_decode_hdr_maxsz + \
125 2 + \ 127 2 + \
@@ -2515,14 +2517,12 @@ static int decode_attr_files_total(struct xdr_stream *xdr, uint32_t *bitmap, uin
2515 2517
2516static int decode_pathname(struct xdr_stream *xdr, struct nfs4_pathname *path) 2518static int decode_pathname(struct xdr_stream *xdr, struct nfs4_pathname *path)
2517{ 2519{
2518 int n; 2520 u32 n;
2519 __be32 *p; 2521 __be32 *p;
2520 int status = 0; 2522 int status = 0;
2521 2523
2522 READ_BUF(4); 2524 READ_BUF(4);
2523 READ32(n); 2525 READ32(n);
2524 if (n < 0)
2525 goto out_eio;
2526 if (n == 0) 2526 if (n == 0)
2527 goto root_path; 2527 goto root_path;
2528 dprintk("path "); 2528 dprintk("path ");
@@ -2579,13 +2579,11 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, st
2579 goto out_eio; 2579 goto out_eio;
2580 res->nlocations = 0; 2580 res->nlocations = 0;
2581 while (res->nlocations < n) { 2581 while (res->nlocations < n) {
2582 int m; 2582 u32 m;
2583 struct nfs4_fs_location *loc = &res->locations[res->nlocations]; 2583 struct nfs4_fs_location *loc = &res->locations[res->nlocations];
2584 2584
2585 READ_BUF(4); 2585 READ_BUF(4);
2586 READ32(m); 2586 READ32(m);
2587 if (m <= 0)
2588 goto out_eio;
2589 2587
2590 loc->nservers = 0; 2588 loc->nservers = 0;
2591 dprintk("%s: servers ", __FUNCTION__); 2589 dprintk("%s: servers ", __FUNCTION__);
@@ -2598,8 +2596,12 @@ static int decode_attr_fs_locations(struct xdr_stream *xdr, uint32_t *bitmap, st
2598 if (loc->nservers < NFS4_FS_LOCATION_MAXSERVERS) 2596 if (loc->nservers < NFS4_FS_LOCATION_MAXSERVERS)
2599 loc->nservers++; 2597 loc->nservers++;
2600 else { 2598 else {
2601 int i; 2599 unsigned int i;
2602 dprintk("%s: using first %d of %d servers returned for location %d\n", __FUNCTION__, NFS4_FS_LOCATION_MAXSERVERS, m, res->nlocations); 2600 dprintk("%s: using first %u of %u servers "
2601 "returned for location %u\n",
2602 __FUNCTION__,
2603 NFS4_FS_LOCATION_MAXSERVERS,
2604 m, res->nlocations);
2603 for (i = loc->nservers; i < m; i++) { 2605 for (i = loc->nservers; i < m; i++) {
2604 unsigned int len; 2606 unsigned int len;
2605 char *data; 2607 char *data;
@@ -3476,10 +3478,11 @@ static int decode_readdir(struct xdr_stream *xdr, struct rpc_rqst *req, struct n
3476 struct xdr_buf *rcvbuf = &req->rq_rcv_buf; 3478 struct xdr_buf *rcvbuf = &req->rq_rcv_buf;
3477 struct page *page = *rcvbuf->pages; 3479 struct page *page = *rcvbuf->pages;
3478 struct kvec *iov = rcvbuf->head; 3480 struct kvec *iov = rcvbuf->head;
3479 unsigned int nr, pglen = rcvbuf->page_len; 3481 size_t hdrlen;
3482 u32 recvd, pglen = rcvbuf->page_len;
3480 __be32 *end, *entry, *p, *kaddr; 3483 __be32 *end, *entry, *p, *kaddr;
3481 uint32_t len, attrlen, xlen; 3484 unsigned int nr;
3482 int hdrlen, recvd, status; 3485 int status;
3483 3486
3484 status = decode_op_hdr(xdr, OP_READDIR); 3487 status = decode_op_hdr(xdr, OP_READDIR);
3485 if (status) 3488 if (status)
@@ -3503,6 +3506,7 @@ static int decode_readdir(struct xdr_stream *xdr, struct rpc_rqst *req, struct n
3503 end = p + ((pglen + readdir->pgbase) >> 2); 3506 end = p + ((pglen + readdir->pgbase) >> 2);
3504 entry = p; 3507 entry = p;
3505 for (nr = 0; *p++; nr++) { 3508 for (nr = 0; *p++; nr++) {
3509 u32 len, attrlen, xlen;
3506 if (end - p < 3) 3510 if (end - p < 3)
3507 goto short_pkt; 3511 goto short_pkt;
3508 dprintk("cookie = %Lu, ", *((unsigned long long *)p)); 3512 dprintk("cookie = %Lu, ", *((unsigned long long *)p));
@@ -3551,7 +3555,8 @@ static int decode_readlink(struct xdr_stream *xdr, struct rpc_rqst *req)
3551{ 3555{
3552 struct xdr_buf *rcvbuf = &req->rq_rcv_buf; 3556 struct xdr_buf *rcvbuf = &req->rq_rcv_buf;
3553 struct kvec *iov = rcvbuf->head; 3557 struct kvec *iov = rcvbuf->head;
3554 int hdrlen, len, recvd; 3558 size_t hdrlen;
3559 u32 len, recvd;
3555 __be32 *p; 3560 __be32 *p;
3556 char *kaddr; 3561 char *kaddr;
3557 int status; 3562 int status;
@@ -3646,7 +3651,8 @@ static int decode_getacl(struct xdr_stream *xdr, struct rpc_rqst *req,
3646 if (unlikely(bitmap[0] & (FATTR4_WORD0_ACL - 1U))) 3651 if (unlikely(bitmap[0] & (FATTR4_WORD0_ACL - 1U)))
3647 return -EIO; 3652 return -EIO;
3648 if (likely(bitmap[0] & FATTR4_WORD0_ACL)) { 3653 if (likely(bitmap[0] & FATTR4_WORD0_ACL)) {
3649 int hdrlen, recvd; 3654 size_t hdrlen;
3655 u32 recvd;
3650 3656
3651 /* We ignore &savep and don't do consistency checks on 3657 /* We ignore &savep and don't do consistency checks on
3652 * the attr length. Let userspace figure it out.... */ 3658 * the attr length. Let userspace figure it out.... */