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.c28
1 files changed, 15 insertions, 13 deletions
diff --git a/fs/nfs/nfs4xdr.c b/fs/nfs/nfs4xdr.c
index d869a5e5464b..e6e8f3b9a1de 100644
--- a/fs/nfs/nfs4xdr.c
+++ b/fs/nfs/nfs4xdr.c
@@ -91,7 +91,7 @@ static int nfs4_stat_to_errno(int);
91#define encode_getfh_maxsz (op_encode_hdr_maxsz) 91#define encode_getfh_maxsz (op_encode_hdr_maxsz)
92#define decode_getfh_maxsz (op_decode_hdr_maxsz + 1 + \ 92#define decode_getfh_maxsz (op_decode_hdr_maxsz + 1 + \
93 ((3+NFS4_FHSIZE) >> 2)) 93 ((3+NFS4_FHSIZE) >> 2))
94#define nfs4_fattr_bitmap_maxsz 3 94#define nfs4_fattr_bitmap_maxsz 4
95#define encode_getattr_maxsz (op_encode_hdr_maxsz + nfs4_fattr_bitmap_maxsz) 95#define encode_getattr_maxsz (op_encode_hdr_maxsz + nfs4_fattr_bitmap_maxsz)
96#define nfs4_name_maxsz (1 + ((3 + NFS4_MAXNAMLEN) >> 2)) 96#define nfs4_name_maxsz (1 + ((3 + NFS4_MAXNAMLEN) >> 2))
97#define nfs4_path_maxsz (1 + ((3 + NFS4_MAXPATHLEN) >> 2)) 97#define nfs4_path_maxsz (1 + ((3 + NFS4_MAXPATHLEN) >> 2))
@@ -255,7 +255,7 @@ static int nfs4_stat_to_errno(int);
255#define decode_fs_locations_maxsz \ 255#define decode_fs_locations_maxsz \
256 (0) 256 (0)
257#define encode_secinfo_maxsz (op_encode_hdr_maxsz + nfs4_name_maxsz) 257#define encode_secinfo_maxsz (op_encode_hdr_maxsz + nfs4_name_maxsz)
258#define decode_secinfo_maxsz (op_decode_hdr_maxsz + 4 + (NFS_MAX_SECFLAVORS * (16 + GSS_OID_MAX_LEN))) 258#define decode_secinfo_maxsz (op_decode_hdr_maxsz + 1 + ((NFS_MAX_SECFLAVORS * (16 + GSS_OID_MAX_LEN)) / 4))
259 259
260#if defined(CONFIG_NFS_V4_1) 260#if defined(CONFIG_NFS_V4_1)
261#define NFS4_MAX_MACHINE_NAME_LEN (64) 261#define NFS4_MAX_MACHINE_NAME_LEN (64)
@@ -1725,7 +1725,7 @@ static void encode_create_session(struct xdr_stream *xdr,
1725 *p++ = cpu_to_be32(args->flags); /*flags */ 1725 *p++ = cpu_to_be32(args->flags); /*flags */
1726 1726
1727 /* Fore Channel */ 1727 /* Fore Channel */
1728 *p++ = cpu_to_be32(args->fc_attrs.headerpadsz); /* header padding size */ 1728 *p++ = cpu_to_be32(0); /* header padding size */
1729 *p++ = cpu_to_be32(args->fc_attrs.max_rqst_sz); /* max req size */ 1729 *p++ = cpu_to_be32(args->fc_attrs.max_rqst_sz); /* max req size */
1730 *p++ = cpu_to_be32(args->fc_attrs.max_resp_sz); /* max resp size */ 1730 *p++ = cpu_to_be32(args->fc_attrs.max_resp_sz); /* max resp size */
1731 *p++ = cpu_to_be32(max_resp_sz_cached); /* Max resp sz cached */ 1731 *p++ = cpu_to_be32(max_resp_sz_cached); /* Max resp sz cached */
@@ -1734,7 +1734,7 @@ static void encode_create_session(struct xdr_stream *xdr,
1734 *p++ = cpu_to_be32(0); /* rdmachannel_attrs */ 1734 *p++ = cpu_to_be32(0); /* rdmachannel_attrs */
1735 1735
1736 /* Back Channel */ 1736 /* Back Channel */
1737 *p++ = cpu_to_be32(args->fc_attrs.headerpadsz); /* header padding size */ 1737 *p++ = cpu_to_be32(0); /* header padding size */
1738 *p++ = cpu_to_be32(args->bc_attrs.max_rqst_sz); /* max req size */ 1738 *p++ = cpu_to_be32(args->bc_attrs.max_rqst_sz); /* max req size */
1739 *p++ = cpu_to_be32(args->bc_attrs.max_resp_sz); /* max resp size */ 1739 *p++ = cpu_to_be32(args->bc_attrs.max_resp_sz); /* max resp size */
1740 *p++ = cpu_to_be32(args->bc_attrs.max_resp_sz_cached); /* Max resp sz cached */ 1740 *p++ = cpu_to_be32(args->bc_attrs.max_resp_sz_cached); /* Max resp sz cached */
@@ -3098,7 +3098,7 @@ out_overflow:
3098 return -EIO; 3098 return -EIO;
3099} 3099}
3100 3100
3101static int decode_attr_error(struct xdr_stream *xdr, uint32_t *bitmap) 3101static int decode_attr_error(struct xdr_stream *xdr, uint32_t *bitmap, int32_t *res)
3102{ 3102{
3103 __be32 *p; 3103 __be32 *p;
3104 3104
@@ -3109,7 +3109,7 @@ static int decode_attr_error(struct xdr_stream *xdr, uint32_t *bitmap)
3109 if (unlikely(!p)) 3109 if (unlikely(!p))
3110 goto out_overflow; 3110 goto out_overflow;
3111 bitmap[0] &= ~FATTR4_WORD0_RDATTR_ERROR; 3111 bitmap[0] &= ~FATTR4_WORD0_RDATTR_ERROR;
3112 return -be32_to_cpup(p); 3112 *res = -be32_to_cpup(p);
3113 } 3113 }
3114 return 0; 3114 return 0;
3115out_overflow: 3115out_overflow:
@@ -4070,6 +4070,7 @@ static int decode_getfattr_attrs(struct xdr_stream *xdr, uint32_t *bitmap,
4070 int status; 4070 int status;
4071 umode_t fmode = 0; 4071 umode_t fmode = 0;
4072 uint32_t type; 4072 uint32_t type;
4073 int32_t err;
4073 4074
4074 status = decode_attr_type(xdr, bitmap, &type); 4075 status = decode_attr_type(xdr, bitmap, &type);
4075 if (status < 0) 4076 if (status < 0)
@@ -4095,13 +4096,12 @@ static int decode_getfattr_attrs(struct xdr_stream *xdr, uint32_t *bitmap,
4095 goto xdr_error; 4096 goto xdr_error;
4096 fattr->valid |= status; 4097 fattr->valid |= status;
4097 4098
4098 status = decode_attr_error(xdr, bitmap); 4099 err = 0;
4099 if (status == -NFS4ERR_WRONGSEC) { 4100 status = decode_attr_error(xdr, bitmap, &err);
4100 nfs_fixup_secinfo_attributes(fattr, fh);
4101 status = 0;
4102 }
4103 if (status < 0) 4101 if (status < 0)
4104 goto xdr_error; 4102 goto xdr_error;
4103 if (err == -NFS4ERR_WRONGSEC)
4104 nfs_fixup_secinfo_attributes(fattr, fh);
4105 4105
4106 status = decode_attr_filehandle(xdr, bitmap, fh); 4106 status = decode_attr_filehandle(xdr, bitmap, fh);
4107 if (status < 0) 4107 if (status < 0)
@@ -4997,12 +4997,14 @@ static int decode_chan_attrs(struct xdr_stream *xdr,
4997 struct nfs4_channel_attrs *attrs) 4997 struct nfs4_channel_attrs *attrs)
4998{ 4998{
4999 __be32 *p; 4999 __be32 *p;
5000 u32 nr_attrs; 5000 u32 nr_attrs, val;
5001 5001
5002 p = xdr_inline_decode(xdr, 28); 5002 p = xdr_inline_decode(xdr, 28);
5003 if (unlikely(!p)) 5003 if (unlikely(!p))
5004 goto out_overflow; 5004 goto out_overflow;
5005 attrs->headerpadsz = be32_to_cpup(p++); 5005 val = be32_to_cpup(p++); /* headerpadsz */
5006 if (val)
5007 return -EINVAL; /* no support for header padding yet */
5006 attrs->max_rqst_sz = be32_to_cpup(p++); 5008 attrs->max_rqst_sz = be32_to_cpup(p++);
5007 attrs->max_resp_sz = be32_to_cpup(p++); 5009 attrs->max_resp_sz = be32_to_cpup(p++);
5008 attrs->max_resp_sz_cached = be32_to_cpup(p++); 5010 attrs->max_resp_sz_cached = be32_to_cpup(p++);